求幫忙看一下
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ??
? <script type="text/javascript"> ?
? ?var js1=confirm("確定打開網(wǎng)頁?");
? if(js1==true)
? ?var js2=prompt("請輸入網(wǎng)址(僅限1.百度,2.淘寶,3.慕課)");
? ? ? if(js2==1)
? ?window.open('http//www.baidu.com','_blank','height=500px,width=400px,');
if(js2==2)
? ? window.open('http//www.baidu.com','_blank','height=500px,width=400px,');
? if(js2==3)
? ?window.open('http//www.baidu.com','_blank','height=500px,width=400px,');
? ?/* */
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="js1" />?
?</body>
</html>
這個哪里出問題了呀?請指教
2015-08-10
還有,你的onclick="js1"也是無效的,因為變量不能充當方法,還是得老老實實地定義function js1(){}
2015-08-10
親,你代碼里所有的http//www.baidu.com都是無效的,應該是http://www.baidu.com,少了冒號