密碼框的點(diǎn)擊眼睛的顯示與隱藏,圖標(biāo)引用是bootstrap中的fontawesome
(復(fù)制整個(gè) font-awesome 文件夾到您的項(xiàng)目中)
還需要引入
<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="Font-Awesome/css/font-awesome.min.css">
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>密碼框</title>
<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="Font-Awesome/css/font-awesome.min.css">
</head>
<body>
<div class="content">
<div class="input_block">
<i class="fa fa-eye" onclick="hideShowPsw()" id="eye"></i>
<input type="password" id="password" placeholder="密碼"/>
</div>
</div>
<script type="text/javascript">
var eye = document.getElementById("eye");
var password = document.getElementById("password");
//隱藏text block,顯示password block
function hideShowPsw(){
if (password.type == "password") {
password.type = "text";
eye.className='fa fa-eye-slash'
}else {
password.type = "password";
eye.className='fa fa-eye'
}
}
</script>
</body>
</html>
當(dāng)前文章:js實(shí)現(xiàn)密碼框的點(diǎn)擊眼睛的顯示與隱藏
標(biāo)題路徑:http://aaarwkj.com/article26/iidpjg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供手機(jī)網(wǎng)站建設(shè)、品牌網(wǎng)站設(shè)計(jì)、響應(yīng)式網(wǎng)站、網(wǎng)站內(nèi)鏈、虛擬主機(jī)、網(wǎng)站改版
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)