默認網(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 opennew=confirm("是否打開?");// 新窗口打開時彈出確認框,是否打開
? ? if (opennew==true){
? ? ? ? var url=prompt("通過輸入對話框,確定打開的網(wǎng)址");
? ? ? ? if(url!==null){
? ? ? ? ? ? window.open(url,"_blank","width=400,height=500,toolbar=no,menubar=no");
? ? ? ? }
? ? ? ? else{
? ? ? ? ? ? window.open("http: //idcbgp.cn","_blank","width=400,height=500,toolbar=no,menubar=no"); ??
? ? ? ? }
? ? }// 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? else{
? ? ? ? alert("再見");
? ? }
? ? }
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
為什么我這樣寫不能當做的默認呢??有大佬能回答下么
2017-08-30
prompt("提示語","默認值");
判斷的時候if(url!==null&url.length>0){}else{}
2017-08-30
..............
2017-08-30
看不懂你在說什么...