是否打開網頁,點擊取消時,彈出了輸入網址的對話框
? function openWindow(){
? ? ? ?var mycon = confirm("是否打開?");
? ? ? ?var mypro = prompt("確定要打開的網址","http://www.xianlaiwan.cn");
? ? ? ??
? ? ? ?if(mycon == true)
? ? ? ?{
? ? ? ? ? ?
? ? ? ? ? ? if(mypro != null)
? ? ? ? ? ? ?window.open(mypro,'_blank','width=400,height=500,toolbar=no,menubar=no')
? ? ? ? ? ? else
? ? ? ? ? ? ? alert("再見!");
? ? ? ?}
? ? ? ?else
? ? ? ?
? ? ? ? ?alert("結束!");
? ? ? ??
? ? }
2016-09-22
var mycon = confirm("是否打開?");
? ? ? ?if(mycon == true)
? ? ? ?{
? ? ? ? ? ?var mypro = prompt("確定要打開的網址","http://www.xianlaiwan.cn");? ?// 這里是彈出輸入框的位置,按照邏輯,彈框應該是在點擊確認之后才彈。
? ? ? ? ? ? if(mypro != null)
? ? ? ? ? ? ?window.open(mypro,'_blank','width=400,height=500,toolbar=no,menubar=no')
? ? ? ? ? ? else
? ? ? ? ? ? ? alert("再見!");
? ? ? ?}
? ? ? ?else
? ? ? ?
? ? ? ? ?alert("結束!");
? ? ? ??
? ? }
2016-09-22
<script type="text/javascript"> ?
? ? function openWindow(){
? ? ? ? var mycon=confirm("是否確認打開網站?")
? ? // 新窗口打開時彈出確認框,是否打開
? ? if(mycon==true){
? ? ? ? var mypr=prompt("輸入網址:","http://www.xianlaiwan.cn");
? ? ? ? window.open(mypr,'_blank','width=400,height=500,menubar=no,toolbar=no');
? ? }
? ? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? ? ? }
? </script>