淡入淡出的fancybox从ASP.NET调用javascript客户端功能 [英] Fading fancybox calling javascript client side function from ASP.NET
问题描述
我试图用asp.net中的代码调用一个客户端函数,使用下面的代码:
I am trying to call one client side function from the code behind in asp.net using below code:
protected void Button2_Click(object sender, EventArgs e)
{
ClientScript.RegisterClientScriptBlock(this.GetType(), "Script", "<script> showFancy('ClaimNewForm.aspx?ordernumber2=' + $('#TxtContractNumber').val(), 'Send to Claim', '55%', '65%');</script>", false);
}
为此,我已将onclick属性添加到页面的页面渲染:
for that, I have added onclick attribute to page render of the page :
protected void Page_PreRender(object sender, EventArgs e)
{
Button2.Attributes.Add("onclick", "showFancy('ClaimNewForm.aspx?ordernumber2=' + $('#TxtContractNumber').val(), 'Send to Claim', '55%', '65%'); return true;");
}
及以下是我试图调用的showfancy函数:< br $> b $ b
and below is showfancy function that I'm trying to call:
<pre> function showFancy(url, title, width, height) {
$(".fancyBox").fancybox({
'width': width,
'height': height,
'autoScale': true,
'transitionIn': 'elastic',
'transitionOut': 'none',
'type': 'iframe',
'overlayColor': '#000000',
'overlayOpacity': 0.7,
'position': 'fixed',
'scrolling': 'yes',
'modal': false,
'target': "_parent",
"onClosed": function () {
window.location = window.location;
}
});
$('.fancyBox').attr({ href: url, title: title });
$('.fancyBox').click();
}
当我从客户端调用它时功能正常但我在上面使用时方法,show fancybox页面出现但在一段时间后消失。
由于某些原因和预检查,我需要从服务器端调用此函数。任何帮助表示赞赏,如果需要更多详细信息,请告诉我们。
我尝试了什么:
我使用下面的代码:
The function works fine when I call it from client side but when I'm using above method, the show fancybox page appears but disappears after some moments.
For some reasons and pre-checking, I need to call this function from server side. any help is appreciated and let me know if more details are required.
What I have tried:
I'm using below code:
protected void Button2_Click(object sender, EventArgs e)
{
ClientScript.RegisterClientScriptBlock(this.GetType(), "Script", "<script> showFancy('ClaimNewForm.aspx?ordernumber2=' + $('#TxtContractNumber').val(), 'Send to Claim', '55%', '65%');</script>", false);
}
推荐答案
('#TxtContractNumber')。val(),'发送到索赔', '55%','65%');< / script>, false );
}
('#TxtContractNumber').val(), 'Send to Claim', '55%', '65%');</script>", false); }
为此,我已将onclick属性添加到页面呈现页面:
for that, I have added onclick attribute to page render of the page :
protected void Page_PreRender(object sender, EventArgs e)
{
Button2.Attributes.Add("onclick", "showFancy('ClaimNewForm.aspx?ordernumber2=' +
('#TxtContractNumber')。val(),'Send to Claim','55%','65%'); return true;);
}
('#TxtContractNumber').val(), 'Send to Claim', '55%', '65%'); return true;"); }
及以下是我试图打电话的showfancy功能:
and below is showfancy function that I'm trying to call:
<pre> function showFancy(url, title, width, height) {
(& quot; .fancyBox& quot;)。fancybox ({
&#39; width&#39 ;: width,
&#39; height&#39 ;: height,
&#39; autoScale&#39; : true ,
&#39; transitionIn&#39;:&#39; elastic&#39;,
&# 39; transitionOut&#39 ;:&#39; none&#39;,
&#39; type&#39 ;:&#39; iframe&#39;,
& ;#39; overlayColor&#39;:&#39;#000000&#39;,
&#39; overlayOpacity&#39;: 0 。 7 ,
&#39; position&#39 ;:&#39; fixed&#39;,
& ;#39;滚动&#39;:&#39;是&#39;,
&#39; modal&#39;: false ,
&#39; target&#39;:& q uot; _parent& quot;,
& quot; onClosed& quot;: function (){
window 。 location = window 。位置跨度>;
}
});
(".fancyBox").fancybox({ 'width': width, 'height': height, 'autoScale': true, 'transitionIn': 'elastic', 'transitionOut': 'none', 'type': 'iframe', 'overlayColor': '#000000', 'overlayOpacity': 0.7, 'position': 'fixed', 'scrolling': 'yes', 'modal': false, 'target': "_parent", "onClosed": function () { window.location = window.location; } });
这篇关于淡入淡出的fancybox从ASP.NET调用javascript客户端功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!