日期:2014-05-18  浏览次数:20549 次

页面里面只有一个用户控件,加不了 onbeforeunload
一般的页面可以再BODY里面加 onbeforeunload
可是在用户控件里没有BODY,请问怎么在用户控件里加onbeforeunload?



------解决方案--------------------
Page.ClientScript.RegisterStartupScript(Page.GetType(), "js", "window.onbeforeunload=xx", true);



<script>
function xx() {
alert("onbeforeunload")
}
</script>