課程
/前端開(kāi)發(fā)
/JavaScript
/JavaScript入門篇
求大神多多費(fèi)力指導(dǎo)一下,謝謝
2019-03-18
源自:JavaScript入門篇 2-7
正在回答
ture改成true
var 后邊的值不能和上邊的function的函數(shù)名一樣
個(gè)人感覺(jué)這個(gè)題目有點(diǎn)冗余,先彈出確認(rèn)框確認(rèn)“是否打開(kāi)”,如果點(diǎn)“確定”,進(jìn)入對(duì)話輸入框“是否打開(kāi)http://yifanck.cn",這時(shí)輸入框又沒(méi)說(shuō)需不需要輸入”是“才跳轉(zhuǎn)。所以我直接通過(guò)確認(rèn)框確認(rèn)后跳轉(zhuǎn)到該網(wǎng)址了
? <script type="text/javascript">? ?? function openWindow(){??? var a=confirm("是否打開(kāi)http://yifanck.cn/?");??? if (a==true)??????? window.open('http://yifanck.cn/','_blank','width=400,height=500,toolbar=no,menubar=no');? ? else? ? window.close;?? }? </script>?
<!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(){
? ? ? ? var mymesenge=confirm('是否開(kāi)啟新網(wǎng)站');
? ? ? ? if(mymesenge==true)
? ? ? ? {
? ? ? ? window.open('http://yifanck.cn/','width=400,height=500,menubar=no,toolbar=no');
? ? ? ? }
? ? ? ? else
? ? ? ? ? ?mymesenge.close();?
? ? }
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開(kāi)網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
professor景
prompt返回的是第二參數(shù),你的第二個(gè)參數(shù)改改
? function? openWindow(){
? ? ? ? var pd =? confirm("是否打開(kāi)");
? ? ? ? if(pd==true){
? ? ? ? var newd= window.open('http://yifanck.cn','_blank','width=400,height=500,menubar=no,toolbar=no');
這樣就可以吧
試過(guò),confirm和prompt都不能正常顯示,不知道什么情況,感覺(jué)代碼也沒(méi)錯(cuò)
open里的url要換成具體網(wǎng)址,還有不用寫的這么復(fù)雜吧
第15行的url換成“http://yifanck.cn"試試
舉報(bào)
JavaScript做為一名Web工程師的必備技術(shù),本教程讓您快速入門
4 回答看不出哪里錯(cuò)了,求大神指導(dǎo)
1 回答求大神看問(wèn)題出在哪
2 回答求大神指導(dǎo)
1 回答求大神指導(dǎo)
4 回答求大神幫忙看下問(wèn)題出在哪里
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2019-03-27
ture改成true
2019-03-27
var 后邊的值不能和上邊的function的函數(shù)名一樣
2019-03-19
個(gè)人感覺(jué)這個(gè)題目有點(diǎn)冗余,先彈出確認(rèn)框確認(rèn)“是否打開(kāi)”,如果點(diǎn)“確定”,進(jìn)入對(duì)話輸入框“是否打開(kāi)http://yifanck.cn",這時(shí)輸入框又沒(méi)說(shuō)需不需要輸入”是“才跳轉(zhuǎn)。所以我直接通過(guò)確認(rèn)框確認(rèn)后跳轉(zhuǎn)到該網(wǎng)址了
? <script type="text/javascript">?
?? function openWindow(){
??? var a=confirm("是否打開(kāi)http://yifanck.cn/?");
??? if (a==true)
??????? window.open('http://yifanck.cn/','_blank','width=400,height=500,toolbar=no,menubar=no');
? ? else
? ? window.close;
?? }
? </script>?
2019-03-18
<!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(){
? ? ? ? var mymesenge=confirm('是否開(kāi)啟新網(wǎng)站');
? ? ? ? if(mymesenge==true)
? ? ? ? {
? ? ? ? window.open('http://yifanck.cn/','width=400,height=500,menubar=no,toolbar=no');
? ? ? ? }
? ? ? ? else
? ? ? ? {
? ? ? ? ? ?mymesenge.close();?
? ? ? ? }
? ? }
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開(kāi)網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2019-03-18
prompt返回的是第二參數(shù),你的第二個(gè)參數(shù)改改
2019-03-18
? function? openWindow(){
? ? ? ? var pd =? confirm("是否打開(kāi)");
? ? ? ? if(pd==true){
? ? ? ? var newd= window.open('http://yifanck.cn','_blank','width=400,height=500,menubar=no,toolbar=no');
? ? ? ? }
? ? }
這樣就可以吧
2019-03-18
試過(guò),confirm和prompt都不能正常顯示,不知道什么情況,感覺(jué)代碼也沒(méi)錯(cuò)
2019-03-18
open里的url要換成具體網(wǎng)址,還有不用寫的這么復(fù)雜吧
2019-03-18
第15行的url換成“http://yifanck.cn"試試