Javascript 如何获取 修改 div style中的属性
这段代码无论如何运行都会出现错误求大婶解救哈!<html><head><scriptlanguage="javascript">functionchk(){varUser...
这段代码无论如何运行都会出现错误 求大婶解救哈!
<html>
<head>
<script language="javascript">
function chk(){
var UserName;
var Pwd;
UserName=document.getElementById("Bcuser").value;
Pwd=document.getElementById("Bcpass").value;
if (UserName.length<0){
document.getElementById("landout").style.display="none";
document.getElementById("landover").style.display="black";
}
else{
document.getElementById("landout").style.display="black";
document.getElementById("landover").style.display="none";
}
}
function a(){
alert(Date());
}
</script>
</head>
<!--style="display: none" 登陆-->
<div class="top4" id="landout" style="display: black">
<form action="index.asp" method="post">
<table>
<tr>
<td id="td2">用户名称:</td>
<td id="td3"><input name="Bcuser" type="text" maxlength="15" id="Bcuser"/></td>
<td id="td4"><input name="Normal" type="image" src="images/dl.jpg" /></td>
</tr>
<tr>
<td id="td2">用户密码:</td>
<td id="td3"><input name="Bcpass" type="password" maxlength="15" id="Bcpass"/></td>
<td id="basicModal"><input name="basic" type="image" src="images/zc.jpg" /></td>
</tr>
<tr>
<td> <input type="button" value="提交" onclick="chk()"></td>
</tr>
</table>
</form>
</div>
<!--style="display: none" 显示会员-->
<div class="top7" id="landover" style="display: none" >
</div>
</html> 展开
<html>
<head>
<script language="javascript">
function chk(){
var UserName;
var Pwd;
UserName=document.getElementById("Bcuser").value;
Pwd=document.getElementById("Bcpass").value;
if (UserName.length<0){
document.getElementById("landout").style.display="none";
document.getElementById("landover").style.display="black";
}
else{
document.getElementById("landout").style.display="black";
document.getElementById("landover").style.display="none";
}
}
function a(){
alert(Date());
}
</script>
</head>
<!--style="display: none" 登陆-->
<div class="top4" id="landout" style="display: black">
<form action="index.asp" method="post">
<table>
<tr>
<td id="td2">用户名称:</td>
<td id="td3"><input name="Bcuser" type="text" maxlength="15" id="Bcuser"/></td>
<td id="td4"><input name="Normal" type="image" src="images/dl.jpg" /></td>
</tr>
<tr>
<td id="td2">用户密码:</td>
<td id="td3"><input name="Bcpass" type="password" maxlength="15" id="Bcpass"/></td>
<td id="basicModal"><input name="basic" type="image" src="images/zc.jpg" /></td>
</tr>
<tr>
<td> <input type="button" value="提交" onclick="chk()"></td>
</tr>
</table>
</form>
</div>
<!--style="display: none" 显示会员-->
<div class="top7" id="landover" style="display: none" >
</div>
</html> 展开
1个回答
展开全部
<html>
<head>
<script language="javascript">
function chk(){
var UserName;
var Pwd;
UserName=document.getElementById("Bcuser").value;
Pwd=document.getElementById("Bcpass").value;
if (UserName.length<=0){
document.getElementById("landout").style.display="none";
document.getElementById("landover").style.display="block";
}
else{
document.getElementById("landout").style.display="block";
document.getElementById("landover").style.display="none";
}
}
function a(){
alert(Date());
}
</script>
</head>
<!--style="display: none" 登陆-->
<div class="top4" id="landout" style="display: black">
<form action="index.asp" method="post">
<table>
<tr>
<td id="td2">用户名称:</td>
<td id="td3"><input name="Bcuser" type="text" maxlength="15" id="Bcuser"/></td>
<td id="td4"><input name="Normal" type="image" src="images/dl.jpg" /></td>
</tr>
<tr>
<td id="td2">用户密码:</td>
<td id="td3"><input name="Bcpass" type="password" maxlength="15" id="Bcpass"/></td>
<td id="basicModal"><input name="basic" type="image" src="images/zc.jpg" /></td>
</tr>
<tr>
<td> <input type="button" value="提交" onclick="chk()"></td>
</tr>
</table>
</form>
</div>
<!--style="display: none" 显示会员-->
<div class="top7" id="landover" style="display: none" >是这个意思吗</div>
</html>
采纳吧
block写成black了
,UserName.length的length是不会小于0的,因为最小是0,所以判断条件改成UserName.length<=0
<head>
<script language="javascript">
function chk(){
var UserName;
var Pwd;
UserName=document.getElementById("Bcuser").value;
Pwd=document.getElementById("Bcpass").value;
if (UserName.length<=0){
document.getElementById("landout").style.display="none";
document.getElementById("landover").style.display="block";
}
else{
document.getElementById("landout").style.display="block";
document.getElementById("landover").style.display="none";
}
}
function a(){
alert(Date());
}
</script>
</head>
<!--style="display: none" 登陆-->
<div class="top4" id="landout" style="display: black">
<form action="index.asp" method="post">
<table>
<tr>
<td id="td2">用户名称:</td>
<td id="td3"><input name="Bcuser" type="text" maxlength="15" id="Bcuser"/></td>
<td id="td4"><input name="Normal" type="image" src="images/dl.jpg" /></td>
</tr>
<tr>
<td id="td2">用户密码:</td>
<td id="td3"><input name="Bcpass" type="password" maxlength="15" id="Bcpass"/></td>
<td id="basicModal"><input name="basic" type="image" src="images/zc.jpg" /></td>
</tr>
<tr>
<td> <input type="button" value="提交" onclick="chk()"></td>
</tr>
</table>
</form>
</div>
<!--style="display: none" 显示会员-->
<div class="top7" id="landover" style="display: none" >是这个意思吗</div>
</html>
采纳吧
block写成black了
,UserName.length的length是不会小于0的,因为最小是0,所以判断条件改成UserName.length<=0
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
TableDI
2024-07-18 广告
2024-07-18 广告
Excel一键自动匹配,在线免费vlookup工具,3步完成!Excel在线免费vlookup工具,点击93步自动完成vlookup匹配,无需手写公式,免费使用!...
点击进入详情页
本回答由TableDI提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询