亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

這個網頁為什么打開后顯示是網頁無法訪問?

這個網頁為什么打開后顯示是網頁無法訪問?

祀未 2016-06-14 00:43:13
<!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?open1=confirm("是否打開新頁面?") ??if(open1==true){ ????var?open2=prompt("請輸入網址","http://www.xianlaiwan.cn/") ?????if(open2!=null){ ??????window.open('http://www.xianlaiwan.cn/','_blank','width=400,height=500,toolbar=yes,menubar=no'); ?? ?????}else ????????{ ?????????alert("不能打開哦"); ???????????} ??}else{ ??????alert("還是不能哦"); ??????}? ??} ???</script>? ?</head>? ?<body>? ??<input?type="button"?value="新窗口打開網站"?onclick="openWindow()"?/>? ?</body> </html>
查看完整描述

2 回答

已采納
?
慕萊塢9220042

TA貢獻377條經驗 獲得超508個贊

你好:

首先,這一句有問題:

var?open2=prompt("請輸入網址","http://www.xianlaiwan.cn/")

括號是中文的,改成英文的,而且最后沒有加“;”,也要英文的分號;

其次,這一句:

window.open('http://www.xianlaiwan.cn/','_blank','width=400,height=500,toolbar=yes,menubar=no');

http后面的冒號也是中文的,換成英文的就可以了。

改正后的代碼:

<!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?open1=confirm("是否打開新頁面?")
??if(open1==true){
????var?open2=prompt("請輸入網址","http://www.xianlaiwan.cn/");
?????if(open2!=null){
??????window.open('http://www.xianlaiwan.cn/','_blank','width=400,height=500,toolbar=yes,menubar=no');
??
?????}else
????????{
?????????alert("不能打開哦");
???????????}
??}else{
??????alert("還是不能哦");
??????}?
??}
???</script>?
?</head>?
?<body>?
?<input?type="button"?value="新窗口打開網站"?onclick="openWindow();"?/>?
?</body>
</html>

你可以試試了。

望采納!

查看完整回答
2 反對 回復 2016-06-14
?
一毛錢

TA貢獻156條經驗 獲得超57個贊

http://www.xianlaiwan.cn/? 中間的冒號你用的是中文狀態,應該是http://www.xianlaiwan.cn/

查看完整回答
1 反對 回復 2016-06-14
  • 2 回答
  • 0 關注
  • 1551 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號