您的位置:程序门 -> web 开发 -> javascript



关于表单和js的问题


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


关于表单和js的问题[已结贴,结贴人:zxmmiao]
发表于:2007-02-09 15:40:46 楼主
<meta   http-equiv= "content-type "   content= "text/html;   charset=gb2312 "   />
<script   language= "javascript ">
function   show4(obj,str){
var   td   =   document.getelementbyid(str);
if(checkboxid.checked   ==   true){
td.style.display   =   "block ";
}else{
td.style.display   =   "none ";
}
}
</script>
<body>
<form>
<table   width= "75% "   border= "1 ">
    <tr>
        <td   width= "23% "> 1.什么是医疗保险
<input   type= "checkbox "   name= "checkbox "   id= "checkboxid "     onclick= "show4(this, 'show1 ') "/> </td>
        <td   width= "77% "   id= "show1 "   style= "display:none "> <select   name= "select ">
                    <option> 11111111 </option>
                    <option> 2222222222 </option>
                    <option> 33333333 </option>
        </select> </td>
    </tr>
</table>
</form>


这个为什么我给form去掉,就可以用啊,不去掉就不能用
发表于:2007-02-09 15:57:271楼 得分:0
因为你的show1是在form里面...
发表于:2007-02-09 16:05:242楼 得分:10
<meta   http-equiv= "content-type "   content= "text/html;   charset=gb2312 "   />
<script   language= "javascript ">
function   show4(obj,str){
var   td   =   document.getelementbyid(str);
if(document.getelementbyid( "checkbox ").checked   ==   true){
document.getelementbyid( "show1 ").style.display   =   "block ";
}else{
document.getelementbyid( "show1 ").style.display   =   "none ";
}
}
</script>
<body>
<form>
<table   width= "75% "   border= "1 ">
<tr>
<td   width= "23% "> 1.什么是医疗保险
<input   type= "checkbox "   name= "checkbox "   id= "checkbox "   onclick= "show4(this, 'show1 ') "/> </td>
<td   width= "77% "> <div   id= "show1 "   style= "display:none "> <select   name= "select ">
<option> 11111111 </option>
<option> 2222222222 </option>
<option> 33333333 </option>
</select> </div> </td>
</tr>
</table>
</form>
发表于:2007-02-09 16:22:403楼 得分:0
谢谢了,结贴


快速检索

最新资讯
热门点击