通过innerHTML简化脚本

<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Example:InnerHTML</title>
  <script type="text/javascript">
  function noscript()
  {
      if(!document.getElementById||!document.createTextNode){return;}
      var noJSmsg=document.getElementById(‘noscripting‘);
      if(!noJSmsg){return;}
      var replaceMessage=‘<h1>Browser test succeeded(From InnerHTML)<h1>‘;
      replaceMessage=‘<p>We tested if your browser is capable of ‘;
      replaceMessage+=‘supporting the application,and all checked out fine.‘;
      replaceMessage+=‘Please proceed by activating the following link.</p>‘;
      replaceMessage+=‘<p><a href="application.aspx"> Proceed to application</a></p>‘;
      noJSmsg.innerHTML=replaceMessage;
  }
  window.onload=noscript;
  </script>
</head>
<body>
  <p id="noscripting">
  We are sorry,but this application needs JavaScript to be
  enabled to work.Please <a href="contact.html">contact us</a>
  if you cannot enable scripting and we will try to help you in
  other ways
  </p>
</body>
</html>

 

ERROR:

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。