覺得代碼沒錯(cuò),可是就是運(yùn)行不出來(lái)
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>? ?
? <script type="text/javascript">
? function openWindow()
? {
???? ?
? if(confirm("是否打開新網(wǎng)站?"))
? {
?
?? ?
??? // 新窗口打開時(shí)彈出確認(rèn)框,是否打開
?var url=prompt("請(qǐng)輸入打開的網(wǎng)址","http://yifanck.cn/");
?
??? // 通過(guò)輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為 http://yifanck.cn/
?window.open(url, "_blank", "toolbar=no,menubar=no,scrollbars=yes,width=400,height=500");
??? //打開的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。
? }
? }
?? ?
? </script>
?</head>
?<body>
?? ?? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />
?</body>
</html>
2016-12-01
var url=prompt("請(qǐng)輸入打開的網(wǎng)址","http://yifanck.cn/");? ?這句代碼后面的分號(hào) ?你的是中文格式的,換成英文格式的就可以運(yùn)行的~ 第一次回答問(wèn)題。。。
2016-12-02
?function openWindow(){
? ? ?if(confirm("是否打開網(wǎng)站")) ? ?// 新窗口打開時(shí)彈出確認(rèn)框,是否打開
? ? ?{
? ? ? ? ?var score=prompt("是否打開下面的網(wǎng)站","http://www.baidu.com"); ?
? ? ? ? ?// 通過(guò)輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為 http://yifanck.cn/
? ? ? ? ?if(score)
? ? ? ? ?{
? ? ? ? ? ? ?
? ? ? ? ? ? ?window.open("http://www.baidu.com","name1","width=400,height=500,left=500,top=200,menubar=no,toolbar=no,status=no");
? ? ? ? ? ? ? ? //打開的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。
? ? ? ? ?}
? ? ?}
? ? ?}
2016-12-01
犯低級(jí)錯(cuò)誤啊 仔細(xì)看window.open(); 這段最后的分號(hào)你用了中文式的分號(hào); ?你該改成英文式那個(gè)
2016-12-01
我的也是,沒出來(lái),我就過(guò)了,不知道什么問(wèn)題,好像跟你的差不多
2016-12-01
window.open(url,'_blank','width=400,height=500,menubar=no,toolbar=no,scrollbars=yes'); 里面的屬性是單引號(hào)不是雙引號(hào).
2016-12-01
還得在打開窗口時(shí)添加一個(gè)判斷,代碼如下:
還有,請(qǐng)注意大小寫。大神,有錯(cuò)的請(qǐng)改正,我也是個(gè)新手~
2016-12-01
既然寫在上面,就需要Window.onload=function(){
這里面包含js代碼
}
2016-12-01
我也不知道