我了解客户端和服务器端脚本之间的区别。我的MasterPage中有一个javascript函数和变量:varneedToConfirm=false;window.onbeforeunload=confirmExit;functionconfirmExit(){if(needToConfirm){needToConfirm=false;return"Currentlyineditmode.Ifyouleavethepagenowthenyouwillloseunsavedchanges."}}考虑到在我的ASP.NET(客户端)上我可以将我的needToConfirm变量的值更改为tru