通過(guò)prompt獲取網(wǎng)址打開獲取的網(wǎng)址
window.onload=function(){ var question=prompt("請(qǐng)輸入您想登陸的網(wǎng)站:"); if(question!=null){ window.open("http://+'question'") }else var rewrite=confirm("是否重新輸入?"); if(rewrite==true){ prompt("請(qǐng)輸入您想登陸的網(wǎng)站:"); }else{ ? ?document.write("感謝您的使用!再見(jiàn)!") ? ? ? ? ? ?} ? ? ? ?} ? ?} window.open()里面寫的不對(duì) 有沒(méi)有大神知道如何實(shí)現(xiàn)?。??
2017-08-09
<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>瀏覽器對(duì)象</title> <script type="text/javascript"> ? function openWindon(){
if(confirm("確定打開新窗口嗎?")){ var url = prompt("請(qǐng)輸入一個(gè)網(wǎng)址","http://idcbgp.cn/"); ?
window.open( url,"_blank","toolbar=no, menubar=no, scrollbars=yes, ?width=400, height=400"); } } ?
</script> </head><body> ?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindon()" /> </body></html>