為什么點(diǎn)開沒有反應(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 open=confirm("確認(rèn)是否去深圳?");
?if(open==true)
?{var url=prompt("通過對話框輸入網(wǎng)址","www.baidu.com");
if(url!=null)
{window.open(url,'_blank','width=400px','height=500px','menubar=no','toolbar=no')}
else
{alert("再見!");}
}
else{alert("再見!");}
?? }
</script>
?</head>
?<body>
?? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />
?</body>
</html>
2016-10-11
<!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 open=confirm("確認(rèn)是否去深圳?");
?if(open==true)
?{
//var url=prompt("通過對話框輸入網(wǎng)址","www.baidu.com");
var url=prompt("通過對話框輸入網(wǎng)址","http://www.baidu.com");
if(url!=null)
{
? ?// window.open(url,'_blank','width=400px','height=500px','menubar=no','toolbar=no')
? ?window.open(url,'_blank','width=400,height=500,meaubar=no,toolbar=no');
? ??
? ? }
else
? ? {
? ? alert("再見!");
? ? }
}
else
? ? {
? ? ? ? alert("再見!");
? ? }
? ?}
</script>?
?</head>?
?<body>?
? ?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
幫你改了一下,改的地方作了注釋,除此之外,你的兩個alert語句都是以中文分號結(jié)尾的,不對。現(xiàn)在在網(wǎng)頁里可以正常運(yùn)行了
2016-10-11
{alert("再見!");}
}
else{alert("再見!");}
這兩個你用了中文的分號
2016-10-11
alert最后的分號是中文的,應(yīng)該用英文的。