<html> 
<head> 
<SCRIPT LANGUAGE="java script"> 
function openwin() 

OpenWindow=window.open("","newwin","height=250,width=250,toolbar=no,scrollbars="+scroll+",menubar=no";); 
//写成一行 
OpenWindow.document.write("<TITLE>例子</TITLE>" ;) 
OpenWindow.document.write("<BODY BGCOLOR=#FFFFFF>" ;) 
OpenWindow.document.write("<H1>Hello!</h1>" ;) 
OpenWindow.document.write("New window opened!" ;) 
OpenWindow.document.write("</BODY >" ;) 
OpenWindow.document.write("</HTML>" ;) 
OpenWindow.document.close() 

</script> 
</head> 
<body> 
<a href="#" onclick="openwin()">打开一个窗口</a> 
<input type="button" onclick="openwin()" value="打开窗口"> 
</body> 
</html> 请问为什么用不了呢?我在funciton里加了个alert 也不出来 好像就根本进不去啊 谢谢!

解决方案 »

  1.   

    我试了另外一个函数 放在这个函数下面 就可以用,可是这个onclick=“openwin()”一点反应也没有 奇怪啊
      

  2.   

    哦 我知道了他所有的;都写在括号里了 估计是粘贴代码的时候出的问题,拿出来就好了,但是我alert在第一位的话应该也能先显示啊 如果alert 在错误程序前出现 难道不应该先弹出来嘛
      

  3.   

    <script language="javascript" type="text/javascript"> 
    function openwin() 
    { OpenWindow=window.open("","newwin","height=250,width=250,toolbar=no,scrollbars="+scroll+",menubar=no"); 
    //写成一行 
    //写成一行 
    OpenWindow.document.write("<TITLE>例子</TITLE>") ;
    OpenWindow.document.write("<BODY BGCOLOR=#FFFFFF>")  ;
    OpenWindow.document.write("<H1>Hello!</h1>")  ;
    OpenWindow.document.write("New window opened!" )  ;
    OpenWindow.document.write("</BODY >")  ;
    OpenWindow.document.write("</HTML>") ;
    OpenWindow.document.close();

    </script> 
    </head> 
    <body> 
    <a href="#" onclick="openwin()">打开一个窗口</a> 
    <input type="button" onclick="openwin()" value="打开窗口"> 
      

  4.   

    1.
    <SCRIPT LANGUAGE="java script"> 
    改成:
    <script language="javascript" type="text/javascript"> 2.把每句话后面的;去了,写到括号外面
    OpenWindow.document.write("<TITLE>例子</TITLE>" ;
    OpenWindow.document.write("<TITLE>例子</TITLE>");
      

  5.   

    看到了 网上找的code自己分号写里面了 哈哈