现在的位置: 首页 > 综合 > 正文

JavaScript中的

2013年08月16日 ⁄ 综合 ⁄ 共 316字 ⁄ 字号 评论关闭
<html>
 <head>
  <title>Example HTML Page</title>
 </head>
 <body>
  <noscript>
   <center><p style="color:red; font-size:26px;">本页面需要浏览器支持(启用)JavaScript</p></center>
  </noscript>
  <!-- 这里放内容 -->
  <script type="text/javascript">
   alert(1);
  </script>
 </body>
</html>

在以下两种情况下,上述代码<p>标记中的内容会显示出来:

  • 浏览器不支持脚本
  • 浏览器支持脚本,但脚本被禁用。

除此之外,用户在浏览器中永远看不到<noscript>标记中的内容。

抱歉!评论已关闭.