為什么我這樣寫百度首頁出不來???
<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>
2015-08-02
?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>你看下有什么不懂的