下面是我做的沒有效果,也不是很明白邏輯,謝謝大神幫我解答
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>? ?
? <script type="text/javascript"> ?
?? ?
??? // 新窗口打開時彈出確認框,是否打開
??? // 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
??? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
??? function openWindow(){
??????????? var open="http://idcbgp.cn","blank","width=400,height=500";
??????????? if(open==turo){
??????????????? window open(open);
??? }erse{
??????? close;
??? }
?? ?
? </script>
?</head>
?<body>
?? ?? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />
?</body>
</html>
2018-06-08
謝謝?? 明白了
2018-06-08
同學,var是定義變量的,你的函數(shù)里var當時函數(shù)用了,if語句里的應(yīng)該是open==ture而不是open=turo,書寫需要注意,下面是我的函數(shù)體代碼,你可以對比下
? var str="確認打開新網(wǎng)頁嗎?"
? ? var conf=confirm(str);
? ? // 新窗口打開時彈出確認框,是否打開
? ? if(conf==true){
? ? ? ? window.open('http://idcbgp.cn','_blank,','menubar=no,toolbar=no')
??