如何在当前页面上匹配整个JavaScript函数?我的JavaScript函数是:
window.onbeforeunload = function()
{
if( !success )
{
success = true;
alert('Think first! Click CANCEL on the next page to receive a new gift.nn');
window.location = 'http://www.mysite.com/';
return 'nClick CANCELnnOver thousands of gifts have been given out, get yours today!nn';
}
}
和我想动态匹配并替换这个函数为:
window.onbeforeunload=function()
{
return ExitPopup();
}
请帮我解决这个问题
你就不能这么做吗
var newFunction = function()
{
return ExitPopup();
}
和
window.onbeforeunload = newFunction;