我這個(gè)哪里出現(xiàn)問題了
<!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 open=confirm("是否新建網(wǎng)頁?");
??? if(open==true)
??? {var url=prompt("通過輸入對(duì)話框","確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/")
??? if(url!=null)
??? {window.open(url,"_blank",'width=400,height=400,menubar=no,toolbar=no');
}
??? else
??? {alert("byebye");}
??? else
??? {alert("拜拜");}
??? }
? </script>
?</head>
?<body>
?? ?? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />
?</body>
</html>
2016-07-27
<!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 open = confirm("是否新建網(wǎng)頁?");
? ? ? ? ? ?var url;
? ? ? ? ? ?if (open == true) {
? ? ? ? ? ? ? ?{
? ? ? ? ? ? ? ? ? ?url = prompt("請(qǐng)輸入新的網(wǎng)址","http://idcbgp.cn/");
? ? ? ? ? ? ? ? ? ?alert(url);
? ? ? ? ? ? ? ? ? ?if (url != null) {
? ? ? ? ? ? ? ? ? ? ? ?window.open(url);
? ? ? ? ? ? ? ? ? ?} else {
? ? ? ? ? ? ? ? ? ? ? ?alert("byebye");
? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ?}
? ? ? ? ? ?} else {
? ? ? ? ? ? ? ?alert("byebye");
? ? ? ? ? ?}
? ? ? ?}
? ?</script>
</head>
<body>
<form>
? ?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()"/>
</form>
</body>
</html>
這個(gè)可以用,對(duì)比一下
2016-07-27
1.prompt()括號(hào)里只能有一對(duì)“”,?
2.byebye后面那個(gè)括號(hào)改成英文格式的
3.Windows.open…………那行后面缺個(gè) ?}
function openWindow()
? ? {
var open=confirm("是否新建網(wǎng)頁?");
? ? ? ? if(open==true)
? ? ? ? {
var url=prompt("確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/");
? ? ? ? ? ? if(url!=null)
? ? ? ? ? ? {
window.open(url,"_blank",'width=400,height=400,menubar=no,toolbar=no');
? ? ? ? ? ? ? }
? ? ? ? ? ? else
? ? ? ? ? ? {
alert("byebye");
}
}
? ? ? ?else
? ? ? ?{
? alert("拜拜");
? }
? ? }?