慕友們看看哪里出問題了啊
<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("是否新建?");// 新窗口打開時彈出確認框,是否打開
? ? }
? ? ? ? if(open==true)
? ? ? ? {
? ? ? ? ? ? var url=prompt("請輸入網(wǎng)址:","http://idcbgp.cn/"); ?// 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
? ? ? ? ? ?window.open(url,'慕課網(wǎng)','top=100,left=300,height=500,width=400,manubar=yes,toolbar=no,status=no,scrollbars=yes');//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? ? ? }
? ? ? ? else
? ? ? ? {
? ? ? ? ? ?document.write("你沒有打開任何新窗口!")?
? ? ? ? }
? ?</script>?
?</head>?
?<body>?
? ? ? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2016-04-10
你
?function openWindow(){
? ? ? ? var open=confirm("是否新建?");// 新窗口打開時彈出確認框,是否打開
? ? }
的反括號打錯地方了兄弟,
<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("是否新建?");// 新窗口打開時彈出確認框,是否打開
? ??
? ? ? ? if(open==true)
? ? ? ? {
? ? ? ? ? ? var url=prompt("請輸入網(wǎng)址:","http://idcbgp.cn/"); ?// 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
? ? ? ? ? ?window.open(url,'慕課網(wǎng)','top=100,left=300,height=500,width=400,manubar=yes,toolbar=no,status=no,scrollbars=yes');//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? ? ? }
? ? ? ? else
? ? ? ? {
? ? ? ? ? ?document.write("你沒有打開任何新窗口!")?
? ? ? ? }
? ? }
? ?</script>?
?</head>?
?<body>?
? ? ? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
這就可以了
2016-04-11
<!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("是否新建?");// 新窗口打開時彈出確認框,是否打開
if(open==true)
{
var url=prompt("請輸入網(wǎng)址:","http://idcbgp.cn/"); // 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
window.open(url,'慕課網(wǎng)','top=100','left=300','height=500','width=400','manubar=no','toolbar=no','status=no','scrollbars=no');//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
}
else
{
document.write("你沒有打開任何新窗口!")?
}
}
</script>?
</head>?
<body>?
<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
</body>
</html>
2016-04-11
? function openWindow(){
? ? ? ? var open=confirm("是否新建?");// 新窗口打開時彈出確認框,是否打開
? ? } <---這個分號放錯位置了 ?
{
? ? ? ? ? ?document.write("你沒有打開任何新窗口!")?
? ? ? ? }<----你放到這里
2016-04-10
function openWindow(){
? ? ? ? var open=confirm("是否新建?");// 新窗口打開時彈出確認框,是否打開
? ? }
最后這個括號位置不對,放到后面去,另:建議gbk改為utf-8
2016-04-10
你這里的問題是不會打開新的網(wǎng)頁對嗎?
你對window.open()的語法理解上有點不到位
第一個參數(shù)url是指你要打開的網(wǎng)址
第二個參數(shù)例如'_blank'是在一個新的窗口打開你輸入的那個網(wǎng)址
第三個參數(shù)看你的代碼你理解的不錯
你可以去重新復習一下 window.open
http://idcbgp.cn/code/412