<!DOCTYPE qhelp PUBLIC"-//Semmle//qhelp//EN""qhelp.dtd"><qhelp><overview><p>Using the <code>alert</code> function to show a message to the user is disruptive, since an alertdialog prevents the user from accessing the rest of the program's interface until the dialog isclosed. Also, alert dialogs are displayed by the browser and hence cannot be styled to fit withthe rest of the web application, which negatively affects user experience.</p><p>Some developers use <code>alert</code> during debugging, so left over calls to <code>alert</code>may also indicate unfinished code.</p></overview><recommendation><p>Use one of the HTML-based dialog box widgets offered by frameworks such as<a href="http://jqueryui.com">jQuery UI</a>, and consider using a non-modal dialog box where possible.</p></recommendation><example><p>The following code snippet uses <code>alert</code> to print a warning message if an element of a form is notcorrectly filled in. A preferable option would be to visually highlight the corresponding field to providemore context for the warning.</p><sample src="examples/Alert.js" /></example><references><li>Mozilla Developer Network: <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window.alert">Window.alert</a>.</li></references></qhelp>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。