我要瘋了,求大神們幫忙
<!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 myconfirm=confirm("是否打開新窗口?");
? ??
? ? if(myconfirm==true)
? ? {var myprompt=prompt("請輸入網(wǎng)址","http://idcbgp.cn/")
? ? if(myprompt!=null)
? ? ? ? {
? ? ? ? window.open('http://idcbgp.cn/','_blank','width=400px,height=500px,menubar=no,toolbar=no')
? ? ? ? };
? ? else
? ? {alert("你沒有寫網(wǎng)址!")};
? ? };
? ? else
? ? {alert("你沒有打開新窗口!")};
? ? };
? ?
? ??
? </script>?
?</head>?
?<body>?
? ? ? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2016-12-23
if{}和else{}后面不加";"
<!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 myconfirm=confirm("是否打開新窗口?");
?? ??? ?if(myconfirm==true){
?? ??? ??? ?var myprompt=prompt("請輸入網(wǎng)址","http://idcbgp.cn/")
?? ??? ??? ?if(myprompt!=null){
?? ??? ??? ??? ?window.open('http://idcbgp.cn/','_blank','width=400px,height=500px,menubar=no,toolbar=no')
?? ??? ??? ?}else{
?? ??? ??? ??? ?alert("你沒有寫網(wǎng)址!")
?? ??? ??? ?}
?? ??? ?}else{
?? ??? ??? ?alert("你沒有打開新窗口!")
?? ??? ?}?? ?
?? ?}
?</script>
</head>
<body>
???? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />
</body>
</html>