為什么訪問不到?訪問的是http://idcbgp.cn/code/http%EF%BC%9A//idcbgp.cn/這個地址
<!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 o = confirm("確認打開本網頁?");
? ? ? ? if(o==true){
? ? ? ? ? ? var url = 'http://idcbgp.cn/'
? ? ? ? ? ? var p;
? ? ? ? ? ? p = prompt('請輸入網址',url);
? ? ? ? ? ? if(p!=null){
? ? ? ? ? ? ? ? window.open(url);
? ? ? ? ? ? }
? ? ? ? ? ? else{
? ? ? ? ? ? ? ? window.close();
? ? ? ? ? ? }
? ? ? ? ? ??
? ? ? ? ? ?
? ? ? ? ? ??
? ? ? ? }
? ? ? ??
? ? ? ??
? ? }
? ??
? ? // 新窗口打開時彈出確認框,是否打開
? ? // 通過輸入對話框,確定打開的網址,默認為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網站" onclick="openWindow()" />?
?</body>
</html>
2018-02-06
http后面的冒號改成英文的冒號就可以了,我也是這樣
2018-01-18
大哥,你的默認URL寫錯了,引號是中文的引號
?http://idcbgp.cn/
2018-01-10
<!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 o = confirm("確認打開本網頁?");
? ? ? ? if(o==true){
? ? ? ? ? ? var url = 'http://idcbgp.cn/'
? ? ? ? ? ? var p;
? ? ? ? ? ? p = prompt('請輸入網址',url);
? ? ? ? ? ? if(p!=null){
? ? ? ? ? ? ? ? window.open(url);
? ? ? ? ? ? }
? ? ? ? ? ? else{
? ? ? ? ? ? ? ? window.close();
? ? ? ? ? ? }
? ? ? ? ? ??
? ? ? ? ? ?
? ? ? ? ? ??
? ? ? ? }
? ? ? ??
? ? ? ??
? ? }
? ??
? ? // 新窗口打開時彈出確認框,是否打開
? ? // 通過輸入對話框,確定打開的網址,默認為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網站" onclick="openWindow()" />?
?</body>
</html>