??<script?type="text/javascript">??
????function?openWindow(){
????//?新窗口打開時彈出確認框,是否打開
????????var?a=confirm("是否打開輸入對話框");
????//?通過輸入對話框,確定打開的網址,默認為?http://www.xianlaiwan.cn/
????????if(a==true){
????????????var?b=prompt("請輸入你要打開的網址:","http://www.xianlaiwan.cn/")
????????????if(b!=null){
????????????????window.open('b','width=400','height=500','menubar=no','toolbar=no')
????????????}
????????????else{
????????????????window.open('http://www.xianlaiwan.cn','height=500','menubar=no','toolbar=no')
????????????}
????????????
????????}
????}
????//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
??</script>
為何我如上的代碼,打開imooc網站顯示的卻是"http://www.xianlaiwan.cn/error/noexists"錯誤頁面而不是慕課網正常的首頁
2016-05-10
?window.open('b','width=400','height=500','menubar=no','toolbar=no')改為
?window.open(b,'width=400','height=500','menubar=no','toolbar=no')
2016-05-08
==true這里一個=就可以了吧
2016-05-08
if(a==true)中的true刪掉, 不然會導致取消功能失效。
應該為:if(a)這樣就可以。
if(b!=null){
????????????????window.open('b','width=400','height=500','menubar=no','toolbar=no')
????????????}
????????????else{
????????????????window.open('http://www.xianlaiwan.cn','height=500','menubar=no','toolbar=no')
????????????}
這里的判定也刪掉, 直接在后面
寫上:
if(a==true){
????????????var?b=prompt("請輸入你要打開的網址:","http://www.xianlaiwan.cn/");
????????????window.open(b,'_blank','width=400,height=500,menubar=no,toolbar=no');