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