按按鈕沒反應(yīng)
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ??
? <script type="text/javascript"> ?
? ? function openWindow(){
? ? ? ? var a=confirm("是否打開網(wǎng)站?");
? ? ? ? if(a==true){
? ? ? ? ? ? window.open("http://www.baidu.com" "_blank" "width=400,height=500");
? ? ? ? }
? ? ? ? else
? ? ? ? {
? ? ? ? ? ? document.write("沒有打開網(wǎng)站!");
? ? ? ? }
? ? }
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
這樣為什么按鈕沒有反應(yīng)??
2017-03-01
? ? if(a==true){
? ? ? ? ? ? window.open("http://www.baidu.com" "_blank" "width=400,height=500");
? ? ? ? }//改為:window.open('http://www.baidu.com',' _blank','width=400,height=500');
2017-03-06
奇怪,我直接貼你的代碼可以打開啊。
2017-03-02
我試了下,可能是你在代碼里混入了中文模式的標(biāo)點(diǎn),!那個(gè)分號
2017-03-01
a是關(guān)鍵字啊,不能做變量名的?。?/p>
2017-03-01
單雙引號應(yīng)該都可以,但是單引號可以少按一次shift,你自己看著辦咯,這里的問題是你引號之間的","少了
2017-03-01
? window.open("http://www.baidu.com" "_blank" "width=400,height=500"不是雙引號 ? 是單引號?。?!注意細(xì)節(jié)! ??
2017-03-01
window.open('http://www/imooc.com/'.'_blank','width=400,height=500');
window.open()里的內(nèi)容用的是單引號,并douhao gekai