我的這程序錯在哪了
<!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 click = confirm("確認(rèn)框");
???? if(click == true){
???????? var url = prompt("通過輸入對話框,確定打開的網(wǎng)址","http://idcbgp.cn");
??????? if(url !=null){
window.open(url,"_blank",'width=400px,height=500px,menubar=no,toolbar=no');
???????????
??????? }else{
??????????? alert("byebye!");
??????? }
???? }else{
??????????? alert("byebye!");
????? }
???
??? // 新窗口打開時彈出確認(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-05-10
加了最后一個大括號后是對的,那個慕課網(wǎng)上面可能有點問題 ?你不要在慕課網(wǎng)里試效果,你可以復(fù)制你的代碼在一個html文檔里 ?然后編譯就可以出來效果了 ? 你的代碼沒有錯
2016-05-10
少了一個'}'
2016-05-10
對頭,少了一個'}'
2016-05-10
樓上說的對
2016-05-10
?function openWindow(){ ?少了最后一個“}”大括號