課程
/前端開發(fā)
/JavaScript
/JavaScript進階篇
沒有輸入密碼時光標經(jīng)過確定鍵彈出對話框提示 請輸入密碼 ,將密碼填好經(jīng)過確定鍵依然會彈出對話框,怎么才能將輸入后不在提示這個功能實現(xiàn)?
2018-12-22
源自:JavaScript進階篇 6-3
正在回答
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> 鼠標經(jīng)過事件 </title>
<script type="text/javascript">
? ? function message(){
? ? ? var result=confirm("請輸入密碼后,再單擊確定!");
? ? ? if(result==true){
? ? ? ? ?document.getElementById("task").onmouseover="none";??
? ? ? }
</script>
</head>
<body>
<form>
密碼:<input name="password" type="password" >
<input id="task" name="確定" type="button" value="確定" onmouseover="message()"/>?
</form>
</body>
</html>
添加一個if判斷啊。。判斷輸入框如果有值就提交,沒值就彈框。。
qq_浮世之繪_agBHNS
舉報
本課程從如何插入JS代碼開始,帶您進入網(wǎng)頁動態(tài)交互世界
5 回答怎么沒有輸出,求教各位大神
6 回答怎樣在密碼表單已經(jīng)輸入的狀態(tài)下不要彈出confirm對話框
2 回答怎樣在密碼表單已經(jīng)輸入的狀態(tài)下不要彈出confirm對話框
1 回答為什么這個代碼的彈不出對話框
3 回答怎樣在密碼表單中已經(jīng)有輸入的狀態(tài)下不彈出confirm確認對話框
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學習伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2019-03-22
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> 鼠標經(jīng)過事件 </title>
<script type="text/javascript">
? ? function message(){
? ? ? var result=confirm("請輸入密碼后,再單擊確定!");
? ? ? if(result==true){
? ? ? ? ?document.getElementById("task").onmouseover="none";??
? ? ? }
? ? ? }
</script>
</head>
<body>
<form>
密碼:<input name="password" type="password" >
<input id="task" name="確定" type="button" value="確定" onmouseover="message()"/>?
</form>
</body>
</html>
2018-12-24
添加一個if判斷啊。。判斷輸入框如果有值就提交,沒值就彈框。。