求解答為什么我寫的代碼為什么不能實(shí)現(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 condition1=confirm("確定打開網(wǎng)址?");
? var condition2=prompt("請?jiān)俅未_定打開的網(wǎng)址","http://idcbgp.cn/");
? if(condition1==true)
? {
if(condition2!=null)
window.open(condition2,'_blank','width=400px,height=500px,menubar=no,toolbar=no');
else
alert("打開失敗");
}
else
{
alert("打開失敗");
? ? // 新窗口打開時(shí)彈出確認(rèn)框,是否打開
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2016-02-06
function openWindow(){
? var condition1=confirm("確定打開網(wǎng)址?");
? var condition2="http://idcbgp.cn/";
? if(condition1==true)
? {?
?var condition2=prompt("請?jiān)俅未_定打開的網(wǎng)址",condition2);
if(condition2!=null)
window.open(condition2,'_blank','width=400px,height=500px,menubar=no,toolbar=no');
else
alert("打開失敗");
}
else
{
alert("打開失敗");
}
}
別忘了大括號(hào)對稱。