CheckBox选中显示DIV没有选中不显示DIV

hya0114145 2010-05-13 07:38:20
代码如何写
CheckBox选中显示DIV没有选中不显示DIV
...全文
295 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
VirusFu 2010-05-13
  • 打赏
  • 举报
回复
jf........
zy370127267 2010-05-13
  • 打赏
  • 举报
回复
学习了啊!高人……
hoojo 2010-05-13
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 wwq0123 的回复:]
HTML code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
</head>

<body>
<input type="checkbox" onclick="showdiv(this);" />……
function showdiv(ch){
if(ch.checked){
document.getElementById("div").style.display="block";
}
else{
document.getElementById("div").style.display="none";
}
}
[/Quote]
同意
mzgwh198857 2010-05-13
  • 打赏
  • 举报
回复
如下例子:
function xx()//限用选项卡显示
{
if(Form1.selecta1.value=="1")
{ Form1.selecta1.value=0;
document.all.xy.style.display='';
}
else
{ Form1.selecta1.value=1;
document.all.xy.style.display='none';
}

}



<input type="checkbox" name="zzcx" onClick="javascript:zz()" value="1">可组装拆卸

<input type="hidden" name="selecta1" value="1">
wwq0123 2010-05-13
  • 打赏
  • 举报
回复

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
</head>

<body>
<input type="checkbox" onclick="showdiv(this);" />
<div id="div" style="display:none;width:100px;height:100px;border:solid 1px red;">我是div</div>
<script type="text/javascript">
function showdiv(ch){
if(ch.checked){
document.getElementById("div").style.display="block";
}
else{
document.getElementById("div").style.display="none";
}
}
</script>
</body>
</html>

87,997

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧