从asp.net调用javascript客户端函数的fancybox
我试图使用以下代码从asp.net中的代码中调用一个客户端函数:从asp.net调用javascript客户端函数的fancybox,javascript,jquery,asp.net,fancybox,server-side,Javascript,Jquery,Asp.net,Fancybox,Server Side,我试图使用以下代码从asp.net中的代码中调用一个客户端函数: protected void Button2_Click(object sender, EventArgs e) { ClientScript.RegisterClientScriptBlock(this.GetType(), "Script", "<script> showFancy('ClaimNewForm.aspx?ordernumber2=' + $('#TxtCont
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);
}
下面是我试图调用的showfancy函数:
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();
}
当我从客户端调用该函数时,它工作正常,但当我使用上述方法时,showFancyBox页面会出现,但过了一会儿就会消失
出于某些原因和预先检查,我需要从服务器端调用此函数。非常感谢您的帮助,如果需要更多详细信息,请告诉我
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();
}