function posted() {
var ac = "1";
fw_ac=ac;
if (ac=="1") {
$("#fw_body").html("发送短消息成功!");
$("#fw_submit").val("返回上一页");
$("#fw_close").hide();
} else {
$("#fw_body").html("发送失败,请重试!");
$("#fw_close").hide();
$("input[@name='submit']").attr({disabled:false});
}
$("#fw_button").show();
$("#fw_load").hide();
$("#floatwin").runfloatwin();
alert('ok');
}
----------------------------------------------------------------
后台c#代码:
ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "Posted", "posted();", true);
-------------------------------------------------------我的问题:
在网页上直接添加一个html按钮,家上onclick事件调用posted();函数就能显示出层对话框;可是通过aspx Button控件的click事件添加注册脚本事件,运行后,就不会弹出层对话框,但是其中的alert('ok');确执行了。也没报错。奇怪,请高手详解,谢谢!
var ac = "1";
fw_ac=ac;
if (ac=="1") {
$("#fw_body").html("发送短消息成功!");
$("#fw_submit").val("返回上一页");
$("#fw_close").hide();
} else {
$("#fw_body").html("发送失败,请重试!");
$("#fw_close").hide();
$("input[@name='submit']").attr({disabled:false});
}
$("#fw_button").show();
$("#fw_load").hide();
$("#floatwin").runfloatwin();
alert('ok');
}
----------------------------------------------------------------
后台c#代码:
ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "Posted", "posted();", true);
-------------------------------------------------------我的问题:
在网页上直接添加一个html按钮,家上onclick事件调用posted();函数就能显示出层对话框;可是通过aspx Button控件的click事件添加注册脚本事件,运行后,就不会弹出层对话框,但是其中的alert('ok');确执行了。也没报错。奇怪,请高手详解,谢谢!
应该和这个没关系吧~~~RegisterStartupScript 把js脚本加载至页首
RegisterClientScriptBlock 把js脚本加载至页中
{
var ac = "1";
fw_ac=ac;
if (ac=="1")
{
document.getElementById('fw_body').innerHtml = "发送短消息成功!";
document.getElementById('fw_submit').value= "返回上一页";
document.getElementById('fw_close').style.display = "none";
}
else
{
document.getElementById('fw_body').innerHtml = "发送失败,请重试!";
document.getElementById('fw_close').style.display = "none";
var submites = document.getElementsByTagName("input");
for (var i = 0; i < submites.length; i++)
{
if (submites[i].name == "submit")
{
submites[i].style.display = "none";
}
}
} document.getElementById('fw_button').style.display = "block";//如果需要行内,改为inline-block
document.getElementById('fw_load').style.display = "none"; //$("#floatwin").runfloatwin(); 不知道什么意思 alert('ok');
}