如何修改警报? [英] How Do I Modify An Alert?

查看:60
本文介绍了如何修改警报?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码在用户尝试关闭窗口时弹出警告。

但是,我需要一些警告上的按钮来帮助我重定向到正常警报其他一页。



I am using the following code to pop up an alert when user tries to close the window.
But, instead of normal alert, i need some button on the alert that helps me to redirect to some other page.

<script language="JavaScript" type="text/javascript">
  window.onbeforeunload = confirmExit;
  function confirmExit()
  {
  
    return "Are you sure you want to exit?";
  }
</script>







请帮助。




Please help.

推荐答案

您无法修改警报。这没什么意义。请参阅我最近的文章,该文章详细解释了所有相关问题:从零开始的模态弹出窗口 [ ^ ]。



在本文中,我首先解释了模态弹出的概念。要点是:警报,确认和提示几乎不适合任何生产级应用。



您没有必要使用我的代码。首先,我的文章解释了如何自己创建这样的工具,并解释了在哪里可以找到其他实现。首先,它是jQuery UI对话框和众多第三方插件。



-SA
You cannot "modify alert". And it would make little sense. Please see my recent article which explains all related issues in detail: Modal Popup From Scratch[^].

In this article, I,first of all, explain the concept of "modal popup". Main point is: "alert", "confirm" and "prompt" are hardly can be considered suitable for any production-level application.

You don't have to use my code. First of all, my article explains how to create such facility by yourself, and explains where you can find other implementations. First of all, it's jQuery UI dialog and numerous 3rd-party plug-ins to it.

—SA


这篇关于如何修改警报?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆