為什么這樣寫,點(diǎn)取消也是打開網(wǎng)頁,哪里錯(cuò)了?
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>window.open</title>
<script type="text/javascript">
? function Wopen(){
? ? ? var mymessage=confirm("是否打開慕課網(wǎng)");
? ? ? if(mymessage==true)
? ? ? {
? ? ? ? ? window.open('http://idcbgp.cn','_blank','height=1300,width=1200,top=100px,left=0px,menubar=yes,toolbar=yes, status=yes,scrollbars=yes')
? ? ? ? ??
? ? ? ? ? }
? ? ? else
? ? ? {alert ("打開失敗");
? ? ? ? }
? ? ? }
</script>
</head>
<body>
? ? <input name="button" type="button" onClick="Wopen()" value="點(diǎn)擊我,打開新窗口!" / >
</body>
</html>
2016-03-25
你這樣寫點(diǎn)擊按鈕都不會(huì)出現(xiàn)彈出框,你var mymessage=confirm("是否打開慕課網(wǎng)");后邊的分號(hào)錯(cuò)了
2016-03-25
你好,試驗(yàn)了一下,發(fā)現(xiàn)這句“var mymessage=confirm("是否打開慕課網(wǎng)");”中的“;”使用的是全角的分號(hào)。建議改成半角的、英文狀態(tài)下的分號(hào)試試。
2016-03-25
你的var mymessage=confirm("是否打開慕課網(wǎng)");分號(hào)用的中文輸入法,改一下就對(duì)了