輸入任何網(wǎng)址都是彈出慕課網(wǎng)為什么呀
<!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 message=confirm("打開新的網(wǎng)頁么");??
????? if(message==true)
????? {add=prompt("請輸入要打開的網(wǎng)址");
????? window.open('add','_blank','width=400,height=500');
????? }
??? }
???
???
? </script>
?</head>
?<body>
?? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />
?</body>
</html>
2016-01-08
不能夠呀,是不是彈出對話框的時候沒有輸入http://。直接輸入網(wǎng)址。
需要注意一點(diǎn),現(xiàn)在的瀏覽器輸入框都做過處理。所以前面沒輸入http://也可以鏈接到正確的網(wǎng)站的。但是這里的js用的是原始的,需要加上超文本傳輸協(xié)議。超文本傳輸協(xié)議就是http://。
你試試看。
2016-01-07
變量名不需要加引號,把包裹add的引號刪去。