<!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>点击登陆显示登陆的层的窗口</title>
<script type="text/javascript">
function showLogin(){
var loginDiv = document.getElementById("loginDiv");
loginDiv.style.display="";
}
function hideLogin(){
var loginDiv = document.getElementById("loginDiv");
loginDiv.style.display="none";
}
</script>
</head>
<body>
<a href="javascript:showLogin()">登陆</a>
<div style="position:absolute;top:200px;left:200px;border:solid 1px green;display:none;" id="loginDiv">
<img src="close.jpg" style="float:right" οnclick="hideLogin()"/>
<table>
<tr>
<td>
<label for="username">用户名</label>
</td>
<td>
<input type="text" id="username"/>
</td>
</tr>
<tr>
<td>
<label for="password">密 码</label>
</td>
<td>
<input type="password" id="password"/>
</td>
</tr>
</table>
</div>
</body>
</html>
javascript操作DOM点击登陆显示登陆的层的窗口
最新推荐文章于 2021-02-01 02:19:10 发布