為什么我最終打開的網址不是慕課網?
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ??
? <script type="text/javascript"> ?
? ? function openWindow(){
? ? ? ?var st = prompt('是否打開網址?','http://www.xianlaiwan.cn');
? ? ? ?if(st){
? ? ? ? ? ?window.open('st','_blank','width=400px,height=500px')
? ? ? ?}
? ? ??
? ? ? ? }
? ? // 新窗口打開時彈出確認框,是否打開
? ? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網站" onclick="openWindow()" />?
?</body>
</html>
2017-01-16
?window.open('st','_blank','width=400px,height=500px')
這句里的st寫錯了,不應該加單引號
2017-01-12
打開的時候網址顯示的我的變量st
2017-01-12
確認網址輸入的是否正確? ?