本教程操作环境:windows10系统、javascript1.8.5版、dell g3电脑。
javascript中alert的用法是什么定义和用法
alert() 方法用于显示带有一条指定消息和一个 ok 按钮的警告框。
语法
alert(message)
参数 描述
message 要在 window 上弹出的对话框中显示的纯文本(而非 html 文本)
示例如下:
<html><head><script type="text/javascript">function disp_alert(){alert("我是一个消息框!")}</script></head><body><input type="button" onclick="disp_alert()" value="显示消息框" /></body></html>
输出结果:
相关推荐:javascript学习教程
以上就是javascript中alert的用法是什么的详细内容。
