如何實(shí)現(xiàn)window .open打開prompt中的值
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ??
? <script type="text/javascript"> ?
? ? function openWindow()
{
? ? ?var message=confirm("是否要打開新窗口?")
? ? ?if(message==true)
? ? ?{
? ? ? var href=prompt("請輸入網(wǎng)址:");
? ? ? if(href!=null)
? ? ? ?{?
? ? ? ? window.open(href,'_blank','width=400,height=500,menubar=no,toolbar=no')
? ? ? ?}
? ? ? ?else
? ? ? ?{window.open('http://idcbgp.cn','_blank','width=400,height=500,menubar=no,toolbar=no')
? }
? ? ?}
? ? ?else
? ? ?{
? ? ?document.write("你取消了操作!") ? ?
? ? ?}
? ? }
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
先編輯如上,可以獲得值,但無法打開prompt中的網(wǎng)址。請大蝦……
2015-02-09
可以打開啊,不過你在prompt中輸入網(wǎng)址的時(shí)候,需要帶http://這個(gè)前綴
2016-04-06
怎么懂了,我也在這個(gè)上面遇到難度了,怎么window.open()取得prompt輸入的網(wǎng)址
2015-02-13
下次研究下自動(dòng)填入http://
2015-02-11
也就是我之前問的“如何取出prompt對話框中輸入的值?”,你的回答我試了但不行
2015-02-11
我是希望打開客戶端輸入的值,不是服務(wù)器端本來就有的值。