關于代碼的筆記記錄!
<!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=prompt("是否打開下列網站","http://www.xianlaiwan.cn/");
???? if(_open!=null)
???? {
???????? window.open(_open,"_blank","width=400,hight=500,toolbar=no");
???? }
? }// 新窗口打開時彈出確認框,是否打開
??? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
??? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
?? ?
?? ?
? </script>
?</head>
?<body>
?? ?? <input type="button" value="點擊打開網站" onclick="openWindow()" />
?</body>
</html>
上述代碼正確,記錄一下我的錯誤位置
第一個錯誤:網頁的冒號直接復制粘貼導致網頁錯誤
第二個錯誤:window。open()里面第一個參數如果直接為網頁地址,則不需要再添加雙引號or單引號
以上
2020-02-13
用confirm邏輯分明一些