不知道哪錯了,就是打不開,求指教
<script type="text/javascript">
? ?function openWindow(){
? ?var myaa=confirm("是否打開對話框");
? ?// 新窗口打開時彈出確認(rèn)框,是否打開
? ? ? if(myaa==true) {
? ?var myss=prompt("在此輸入網(wǎng)址","http://idcbgp.cn");
? ?if(myss!=null){
? ? ? ?window.open(myss,"_blank","width=400px, height=500px,menubar=no, toolbar=no");
? ?}
? ?// 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ?else{
? ? ? ?alert("檢查網(wǎng)址");
? ?}
? ?}
? ?//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? ?else{
? ? ?alert("再見!");
? ? ?}
? ?}
</script>
2016-08-17
JS里面應(yīng)該沒有錯
2016-08-17
?你的原碼: if(myss!=null){
? ? ? ?window.open(myss,"_blank","width=400px, height=500px,menubar=no, toolbar=no");
? ?}
其中window.open()里邊的參數(shù)應(yīng)該用單引號,不是雙引號。即應(yīng)修改為如下樣式:
if(myss!=null){
? ? ? ?window.open(myss,'_blank','width=400px, height=500px,menubar=no, toolbar=no');
? ?}
親測,改完之后就可以用了。