請問怎么把prompt的返回值(網址)放到window.open中
var?mp=prompt('確定打開的網址:','http://www.xianlaiwan.cn'); if(mp!=null) { ????window.open('http://www.xianlaiwan.cn/','_blank','width=400px,height=500px,menubar=no,toolbar=no'); }
這個地方僅僅是把返回值用來判斷非空,要怎么把這個返回的字符串當做是url來用呢
var?mp=prompt('確定打開的網址:','http://www.xianlaiwan.cn'); if(mp!=null) { ????window.open('http://www.xianlaiwan.cn/','_blank','width=400px,height=500px,menubar=no,toolbar=no'); }
這個地方僅僅是把返回值用來判斷非空,要怎么把這個返回的字符串當做是url來用呢
2016-12-23
舉報
2016-12-23
window.open(mp,'width=400px,height=500px,menubar=no,toolbar=no');
這樣就行了啊,直接把prompt()的返回值作為open()的第一個參數
2016-12-23
我也想知道,不過我覺得直接使用==號好像就行吧,或者使用equals方法比較一下