由 hrs 提交于 2020/11/04 - 09:43 , 周三 使用 window.alert()警告框来显示数据,注意,这个实例是打开网页先警告提示,再显示网页。 实例代码: <!doctype html> <head> <meta charset="utf-8"> </head> <html> <body> <h1>我的第一张网页</h1> <p>这是一个5+6的计算结果</p> <script> window.alert("5+6="+(5+6)); </script> <p style="color:red">注意:计算结果将在警告窗中输出! </p> </body> </html> 运行效果: 标签 JavaSrcipt 登录或注册以发表评论