代碼寫出來了但顯示不了效果,不知道哪出問題了?求指點(diǎn):
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title>??
? <meta http-equiv="Content-Type" content="text/html,charset=utf-8"/>? ?
? <script type="text/javascript">??
? ? function openWidow(){
? ? // 新窗口打開時彈出確認(rèn)框,是否打開
? ? ? ? var input=confirm("確認(rèn)打開?");
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? ? ? if(input==ture){
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? ? ? ? ? window.open('http://idcbgp.cn/','_blank','menubar=no,scrollbars=yes,toolbar=no,status=no')
? ? ? ? }else
? ? ? ? {? ?alert("null");
? ? ? ? ? ? }?
? ? ? ? openWidow();
? ? }
? </script>?
?</head>?
?<body>?
? <input name="button" type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2018-09-24
給你參考一下。
你代碼的問題:
1、少了一個輸入框 prompt。
2、window.open 語句后面沒有分號,
2018-09-26
<!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 dakai=confirm("打開窗口嗎?");
? ? if(dakai==true)
? ? {
? ? ? ??
? ? ? ? var duihua=prompt("Input url:","http://idcbgp.cn");
? ? ? ? if(duihua!=null){
? ? ? ? ? ? window.open(,'_blank','width=400px,height=500px,menubar=no,toolbar=no');
? ? ? ? }
? ? ? ? else
? ? ? ? {
? ? ? ? ? ? alert("謝謝使用!")
? ? ? ? }
? ? ? ?
? ? }
? ? else{
? ? ? ? document.write("前端很好,你要學(xué)習(xí)哦!")
? ? }
? }
? ? // 新窗口打開時彈出確認(rèn)框,是否打開
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2018-09-25
function openWidow(){
? ? // 新窗口打開時彈出確認(rèn)框,是否打開
? ? ? ? var input=confirm("Open a new window?");
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? ? ? if(input==true){
? ? ? ? ? ? var url=prompt("input url:","http://idcbgp.cn);
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? window.open(url,'_blank','width:400,height:500,menubar=no,toolbar=no')
? ? ? ? ? ? }else{alert("null");
? ? ? ? }
? ? }
問題找到了,input==true錯寫成input==ture;
2018-09-24
function openWidow(){
? ? // 新窗口打開時彈出確認(rèn)框,是否打開
? ? ? ? var input=confirm("Open a new window?");
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? ? ? if(input==ture){
? ? ? ? ? ? var url=prompt("input url:","http://idcbgp.cn);
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? window.open(url,'_blank','width:400,height:500,menubar=no,toolbar=no')
? ? ? ? ? ? }else{alert("null");
? ? ? ? }
? ? }
<--打出如上代碼頁面還是打不開,是網(wǎng)址問題嗎?-->