最后跳轉(zhuǎn)網(wǎng)頁怎么不能跳到prompt()里面輸入的網(wǎng)址呢???
<!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 open=confirm("確定打開新的網(wǎng)頁嗎?"); // 新窗口打開時彈出確認(rèn)框,是否打開
? ? ? ? if(open==true)
? ? ? ? {
? ? ? ? ?var yun=prompt("你好歡迎光臨","idcbgp.cn"); ??
? ? ? ? ?if(yun!=null)
? ? ? ? ?{
? ? ? ? ? ? ?window.open(yun,"_blank","width:400px,height:500px,toolbar=no,menubar=no");
? ? ? ? ?}
? ? ? ? ?else
? ? ? ? ?{
? ? ? ? ? ? ?alert("再見");
? ? ? ? ?}
? ? ? ? }
? ? ? ? else
? ? ? ? {
? ? ? ? ? ? alert("再見");
? ? ? ? }
? ? ? ??
? ? ? ??
? ? ? ??
? ? ? ??
? ? ? ??
? ? ? ??
? ? }
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2017-07-05
不是很清楚你的問題...
如果真要說的話建議你在?var yun=prompt("你好歡迎光臨","idcbgp.cn"); ?中的網(wǎng)址前加上http://
并且如果不想進(jìn)入默認(rèn)網(wǎng)址的話更改默認(rèn)網(wǎng)址前也要加上http://
這樣的話應(yīng)該什么網(wǎng)站都可以進(jìn)入了。
2017-07-07
? 剛剛寫的有問題: function openwindow(){
? ? ? ?
? ? ? ?
? var pip=confirm("是否打開?");
? ?if(pip==true){
? ? window.open( 'http://idcbgp.cn/','_blank','width:600,height:400,top:100,left:0,');
? ? ? }
? ? ? else{alert("結(jié)束"); }
}
2017-07-07
別瞎說,他們寫的都有問題,什么2個if都是錯的,而且運(yùn)行不了,這個地方不是prompt,應(yīng)該是
function openwindow(){
? window.pip=donfirm("是否打開?");
? ?if(pip==turn){
? ? window.open( 'http://idcbgp.cn/','_blank','width:600,height:400,top:100,left:0,');
? ? ? }
? ? ? else{alert("結(jié)束"); }
}你自己好好看看,不謝
2017-07-05
你咧網(wǎng)址寫錯了