<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>window.open</title>
<script type="text/javascript">
function window.open(){
'http://www.baidu.com/','_blank','width=600,hieght=400,top=100px,left=0px '
}
</script>
</head>
<body>
<input name="button" type="button" onClick="window.open()" value="点击我,打开新窗口!" / >
</body>
</html>
function window.open(){ 'http://www.baidu.com/','_blank','width=600,hieght=400,top=100px,left=0px ' }
函数名不要取JS的关键字,也不能带点。我估计你是把函数和方法弄混了。
修改后的代码
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>window.open</title> <script type="text/javascript"> function Wopen(){ window.open('http://www.baidu.com/','_blank','width=600,hieght=400,top=100px,left=0px '); } </script> </head> <body> <input name="button" type="button" onClick="Wopen()" value="点击我,打开新窗口!" / > </body> </html>
你看下有什么不懂的