在window.onbeforeunload上调用WebForm

时间:2013-11-17 14:08:18

标签: c# javascript javascript-events webforms

我想在java脚本上调用“WebForm.aspx”;

<script type="text/javascript">
  window.onbeforeunload = function (e) {
      var msg = 'Are you sure?';
      e = e || window.event;

      if (e)
          e.returnValue = msg;

      return msg;
  }

代码在页面卸载时返回一条消息。我想打开目标网络表单而不是返回消息..

谢谢

任何评论都非常感谢

1 个答案:

答案 0 :(得分:0)

我想我已经知道了

<script type="text/javascript">
  window.onbeforeunload = function (e) {
      var msg = 'Are you sure?';
      e = e || window.event;

      if (e)
      window.showModalDialog('WebForm2.aspx');

  }

感谢