第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

js兩個(gè)if嵌套在一起是如何運(yùn)行的?

js兩個(gè)if嵌套在一起是如何運(yùn)行的?

素胚勾勒不出你 2019-02-12 17:19:12
如這個(gè)登錄驗(yàn)證的例子,兩個(gè)if嵌套在一起是怎么運(yùn)行的?<!DOCTYPE html><html><head>    <title>login</title>    <meta charset="utf-8"></head><body>    <form id="loginform" name='loginform' onsubmit="return checkLogin()">        <div>            <label for="username">賬號:</label>            <input type="text" id="username" name="username">        </div>        <div>            <label for="password">密碼:</label>            <input type="password" id="password" name="password">        </div>        <input type="submit" value="登錄">    </form>    <script type="text/javascript">    //驗(yàn)證登錄    function checkLogin() {        if (loginform.username.value != "") {            if (loginform.password.value != "") {                return ture            } else {                alert('密碼不能為空');                return false            }        } else {            alert('用戶名不能為空');            return false        }    }    </script></body></html>
查看完整描述

2 回答

?
慕田峪9158850

TA貢獻(xiàn)1794條經(jīng)驗(yàn) 獲得超8個(gè)贊

https://img1.sycdn.imooc.com//5c7240410001bfc505720432.jpg

查看完整回答
反對 回復(fù) 2019-02-24
?
慕標(biāo)5832272

TA貢獻(xiàn)1966條經(jīng)驗(yàn) 獲得超4個(gè)贊

var username = loginform.username.value != "";

var password = loginform.password.value != "";

if(!username ){

    alert('用戶名不能為空');

}

if(!password){

    alert('密碼不能為空');

}

return username && password;


查看完整回答
反對 回復(fù) 2019-02-24
  • 2 回答
  • 0 關(guān)注
  • 2076 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號