首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

关于表单和js的有关问题

2012-02-26 
关于表单和js的问题metahttp-equiv Content-Type content text/htmlcharsetgb2312 /scriptlang

关于表单和js的问题
<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去掉,就可以用啊,不去掉就不能用

[解决办法]
<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>

热点排行