求大神指教,謝謝啦
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ??
? <script type="text/javascript"> ?
? ? function=openWindow()
? ? window.open("http://idcbgp.cn/")
? ? var mymessage=confirm("是否打開?")
? ? if(mymessage==true)
? ? {window.open("http://idcbgp.cn/","width=400","height=500","menubar=no","toolbar=no")}
? ? else
? ? {window.close("http://idcbgp.cn/")} ?
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
不知道錯(cuò)在了哪里
2016-10-18
function函數(shù)寫錯(cuò)了,修改及說明:
function openWindow()
{
??? //window.open(http://idcbgp.cn/)?? 如果這里這么寫,程序解析到這里是會(huì)先打開一個(gè)網(wǎng)頁(yè);這句刪掉
? ? var mymessage=confirm("是否打開?")
? ? if(mymessage==true)
? ? {window.open("http://idcbgp.cn/","width=400","height=500","menubar=no","toolbar=no")}
??? //else? ?{window.close("http://idcbgp.cn/")} ? else 可以不寫else語(yǔ)句,表示不操作;或者隨便寫一個(gè) document.write("您選擇不打開網(wǎng)頁(yè)")
}? //注意別漏掉函數(shù)的另一個(gè)大括號(hào)
2016-10-18
function函數(shù)寫錯(cuò)了,修改及說明:
function openWindow()
{
??? //window.open(http://idcbgp.cn/)?? 如果這里這么寫,程序解析到這里是會(huì)先打開一個(gè)網(wǎng)頁(yè);這句刪掉
? ? var mymessage=confirm("是否打開?")
? ? if(mymessage==true)
? ? {window.open("http://idcbgp.cn/","width=400","height=500","menubar=no","toolbar=no")}
??? //else? ?{window.close("http://idcbgp.cn/")} ? else 可以不寫else語(yǔ)句,表示不操作;或者隨便寫一個(gè) document.write("您選擇不打開網(wǎng)頁(yè)")
}? //注意別漏掉函數(shù)的另一個(gè)大括號(hào)
2016-10-18
else
? ? {window.close("http://idcbgp.cn/")}?
你問的是否打開網(wǎng)站,還沒打開怎么關(guān)閉?