<!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?Nweb=confrim("是否打開新窗口?");//?新窗口打開時彈出確認框,是否打開
????????if(Nweb==true){
?????????var?Newweb=prompt("確認打開網(wǎng)址么","http://idcbgp.cn/");?//?通過輸入對話框,確定打開的網(wǎng)址,默認為?http://idcbgp.cn/
?????????
?????????if(Newweb!=null){
?????????window.open(Newweb,'_blank','width=400,height=500,menubar=no,toolbar=no');?//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
?????????}
?????????else{
?????????????alert("再見!");
?????????}
????????}
?????????else{
?????????????alert("再見");
?????????}
????}
??</script>?
?</head>?
?<body>?
????<input?type="button"?value="新窗口打開網(wǎng)站"?onclick="openWindow()"?/>?
?</body>
</html>
2016-09-27
confrim寫錯了是confirm,?if(Nweb==true)這句直接寫成if(Nweb)就好,感覺的變量命名不太好,得遵循駝峰原則,第一個單詞的首字母先小寫為好
2016-09-27
if 的嵌套有問題