好像哪里太對(duì)。。求解
<!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?msg?=?confirm("是否打開?"); ????????if(msg=true){ ????????????var?newopen?=?prompt("請(qǐng)輸入網(wǎng)址",?"http://idcbgp.cn/"); ????????????if(newopen!=null){ ????????????window.open("http://idcbgp.cn","_blank","width=400,?height=500,menubar=no,toolbar=no"); ????????????} ????????????else{ ????????????alert("無(wú)法打開"); ????????} ????????else{ ????????????alert("無(wú)法打開"); ????????} ????} ????//?新窗口打開時(shí)彈出確認(rèn)框,是否打開 ????//?通過(guò)輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為?http://idcbgp.cn/ ????//打開的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。 ??</script>? ?</head>? ?<body>? ??<input?type="button"?value="新窗口打開網(wǎng)站"?onclick="openWindow()"?/>? ?</body> </html>
倆個(gè)else的部分都出不來(lái),為啥
2017-02-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 msg = confirm("是否打開?");
? ? ? ? if(msg==true){
? ? ? ? ? ? var newopen = prompt("請(qǐng)輸入網(wǎng)址", "http://idcbgp.cn/");
? ? ? ? ? ? if(newopen!=null){
? ? ? ? ? ? window.open("http://idcbgp.cn","_blank","width=400, height=500,menubar=no,toolbar=no");
? ? ? ? ? ? }
? ? ? ? ? ? else{
? ? ? ? ? ? alert("無(wú)法打開");
? ? ? ? }
? ? ? ? }
? ? ? ? else{
? ? ? ? ? ? alert("無(wú)法打開");
? ? ? ? }
? ??
? ? }
? ? // 新窗口打開時(shí)彈出確認(rèn)框,是否打開
? ? // 通過(guò)輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。
? </script>?
?</head>?
?<body>?
? ? ? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2017-02-10
? ? ?else
? ? ? ? {
? ? ? ? ? ?alert("無(wú)法打開");
? ? ? ? }
? ? ? ? }
? ? ? ? else
? ? ? ? {alert("無(wú)法打開");}
? ? }
把這個(gè)改一下就可以。額
2017-02-10
if少了一個(gè)};
function?openWindow(){
????????var?msg?=?confirm("是否打開?");
????????if(msg==true){
????????????var?newopen?=?prompt("請(qǐng)輸入網(wǎng)址",?"http://idcbgp.cn/");
????????????if(newopen!=null){
????????????window.open("http://idcbgp.cn","_blank","width=400,?height=500,menubar=no,toolbar=no");
????????????}
????????????else{
????????????alert("無(wú)法打開");
????????}
}
????????else{
????????????alert("無(wú)法打開");
????????}
????}
2017-02-10
大括號(hào)寫的太亂了 對(duì)不上 ?還有判斷是==,=是賦值 ?if(msg=true)應(yīng)該是恒成立