js中關(guān)閉彈窗
<!DOCTYPE?html?PUBLIC?"-//W3C//DTD?XHTML?1.0?Transitional//EN"?"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html?xmlns="http://www.w3.org/1999/xhtml"> <head> <meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"?/> <title>無標(biāo)題文檔</title> <script?type="text/javascript"> ????function?message(){ confirm("請選擇,您現(xiàn)在的職業(yè)!"); } function?aceger(){ alert("請先輸入姓名!"); } function?bceger(){ alert("請先輸入密碼,再點(diǎn)擊確認(rèn)!"); } ?function???cceger(){ ?confirm("是否已輸入密碼?已輸入請按確認(rèn)!"); ?if(confirm()==true){ //這里該怎么寫,才能讓彈窗關(guān)閉 ?} ?else{ ?return?bceger(); ?} ?} </script> <style?type="text/css"> *{margin:0;?padding:0;?font-size:14px;?color:#03F;} #move{float:right;?margin-right:10px;margin-top:-10px;} .pass{margin-top:5px;}/*div?id="move",做css樣式用#;div?classs="pass"做css樣式用.(英文的句號)*/ div:hover{color:#F00;} </style> </head> <body> ?? ???請選擇您的職業(yè):<br?/> ????<form> ????????<select?name="changer"?onfocus="message()"> ??????????????<option>教師</option> ??????????????<option>歌手</option> ??????????????<option>演員</option> ??????????????<option?selected="selected">工程師</option><!--selected=""selected默認(rèn)選中--> ??????????????<option>律師</option> ????????</select> ?????????<div?id="move"> ?????????姓名:<input?name="username"?type="text"?value="請輸入您的姓名"??onblur="aceger()"/><br?/> ?????????<div?class="pass"> ?????????密碼:<input?name="password"?type="text"?value="請輸入密碼"?onmouseout="bceger()"??/> ??????????????????<input?name="button"?type="button"?value="確認(rèn)"?onclick="cceger()"?/>?????????????????? ??????????????????</div> ?????????</div> ????????? ????</form> ???? </body> </html>
代碼第19行該寫什么以達(dá)到點(diǎn)擊彈窗的確認(rèn)按鈕后直接關(guān)閉彈窗
2016-09-07
function???cceger(){
???????? var confirm_ = confirm("是否已輸入密碼?已輸入請按確認(rèn)!");
?????????if(confirm_ == true){???????????
????????????return;
????????}
?????????????else{
?????????????????return?bceger();
?????????????????}
???????? }
2016-09-12
function ? cceger(){
? ? ? ? ?var confirm_ = confirm("是否已輸入密碼?已輸入請按確認(rèn)!");
? ? ? ? ?if(confirm_ == true){ ? ? ? ? ? ?
? ? ? ? ? ? confirm_.close();//這樣寫應(yīng)該效果更明顯吧,其實(shí)我對“return”不太理解;這里寫“return”是返回到哪?
? ? ? ? }
? ? ? ? ? ? ?else{
? ? ? ? ? ? ? ? ?return bceger();
? ? ? ? ? ? ? ? ?}
? ? ? ? ?}
2016-09-11
你這樣寫相當(dāng)于是調(diào)用了兩次confirm(),第二次沒帶參數(shù),所以是一個(gè)空的彈窗。你可以看看confirm()函數(shù)的說明,如果點(diǎn)擊確定,就返回true,然后可以根據(jù)返回值進(jìn)一步操作