代碼沒有任何效果
<!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 message=confirm("是否打開新窗口");
??? // 新窗口打開時彈出確認框,是否打開
??????? if(message==true){
??????????? var link;
??????????? link=window.prompt("請輸入網(wǎng)址",'http://idcbgp.cn');
??? // 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
?????????? window.open('link','blank','width=400;height=500;menubar=no;tolbar=no');
??????? }
??? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
???
???
? </script>
?</head>
?<body>
?? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />
?</body>
</html>
沒有任何效果,這是怎么回事呢
2015-04-30
你的代碼最后少了一個 },沒有閉合。而且如果放在本地編輯器上面charset要設(shè)置utf-8才能顯示中文。