多種取消打開新窗口的方法
var myurl=confirm('是否打開新的網址?'); ? ? ? ?if (myurl) { ? ? ? ? ? ?promp = prompt("請輸入你的網站:",'http://www.xianlaiwan.cn/'); ? ? ? ? ? ?if (promp != "" && promp !=null) { ? ? ? ? ? ? ? ?window.open(promp, '_blank', 'width=400,height=500,menubar=no,toolbar=no'); 這個才是對的 他們的取消全部跳轉null了
2017-05-02
function openWindow(){
? ? ? ? var mymessage=confirm("新窗口是否打開?");// 新窗口打開時彈出確認框,是否打開
? ? ? ??
? ? ? ? if(mymessage==true)
? ? ? ? {
? ? ? ? ? ? var myname=prompt("請輸入網址:","http://www.xianlaiwan.cn");// 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
? ? ? ? ? ? if(myname!=null)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? window.open("http://www.xianlaiwan.cn","_blank",'width=400,height=500,menubar=no,toolbar=no' );//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? ? ? ? ? ? ? }
? ? ? ? }
? ? ? ? else{
? ? ? ? ? ? document.write("新窗口未打開");
? ? ? ? }
? ??
? ? } ?