<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<input name="a23" type="checkbox" id="a3" onClick="javascript:gb()" checked="checked">
<div id="ab"></div>
<script language="javascript">
<!--function gb()
{
ab.innerHTML="<input id=ab name=sdd type=hidden value=s>"
}
--></script>
</body>如上面,我想在点CHECKBOX的时候,当CHECKED被选中的时候 DIV的位置变成一个隐藏的域,可是发现实现不了,我是不是弄错了,怎么做才能实现这个功能
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<input name="a23" type="checkbox" id="a3" onClick="javascript:gb()" checked="checked">
<div id="ab"></div>
<script language="javascript">
<!--function gb()
{
ab.innerHTML="<input id=ab name=sdd type=hidden value=s>"
}
--></script>
</body>如上面,我想在点CHECKBOX的时候,当CHECKED被选中的时候 DIV的位置变成一个隐藏的域,可是发现实现不了,我是不是弄错了,怎么做才能实现这个功能
</html>
<div id="ab" style="background:#F00;height:50px;display:none"></div>
<script language="javascript">
function gb(id){
var id = document.getElementById(id);
if( id.style.display == "block" ){
id.style.display = "none";
}else{
id.style.display = "block";
}
}
</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function gb(obj){
var div = document.getElementById("ab");
if(obj.checked){
div.style.display = "";
}else{
div.style.display = "none";
}
}
</script>
</head><body>
<input name="a23" type="checkbox" id="a3" onClick="gb(this)" checked="checked" />
<div id="ab">aaaaaaaaaaaaaaaaaa</div>
</body>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function gb(obj){
var div = document.getElementById("ab");
if(obj.checked){
div.style.display = "none";
}else{
div.style.display = "";
}
}
</script>
</head><body>
<input name="a23" type="checkbox" id="a3" onClick="gb(this)" checked="checked" />
<div id="ab" style="display:none">aaaaaaaaaaaaaaaaaa</div>
</body>