这段代码有错?为啥老报错  点击按钮报20行语法错误。。郁闷啦<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title> New Document </title>
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <script> function a(){
var a=1;
window.showModalDialog("a.html",null,"dialogHeight=200px;dialogWidth=200px");
alert(window.returnValue);
}
  </script>
 </head> <body>
<input type="button" value="按钮" onclick="a()"/>
 </body>
</html>

解决方案 »

  1.   


    还有个a.html 页面
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
     <head>
      <title> New Document </title>
      <meta name="Generator" content="EditPlus">
      <meta name="Author" content="">
      <meta name="Keywords" content="">
      <meta name="Description" content="">
      <script>
    function a(b){
    window.returnValue=b.value;
    alert(window.returnValue);
    window.close();
    }
      </script>
     </head> <body>
      <input type="button" value="按钮1"  onclick=a(this)/>
        <input type="button" value="按钮2"  onclick=a(this)/>
      <input type="button" value="按钮3"  onclick=a(this)/>
        <input type="button" value="按钮4"  onclick=a(this)/>
      <input type="button" value="按钮5"  onclick=a(this)/>
     </body>
    </html>
      

  2.   

    一样啊。。出现a页面点哪个按钮就提示哪个。。然后就输出alert(window.returnValue);
      

  3.   

    估计是Js方法浏览器兼容问题。。我用的IE9
      

  4.   


    有错 代码写的不规范  onclick后要引号script要加上type  就行了 嘿嘿  
      

  5.   


    代码写的不规范  onclick后要引号script要加上type  就行了 嘿嘿