日期:2014-05-17  浏览次数:20891 次

这个问题是怎么了?
界面有个checkbox,它的代码如下:
<tr>  
                                    <td   width= "80 "   align= "right "> 主题: </td>
                                    <td> <input   name= "Subject "   type= "text "   id= "Subject "   size= "30 "   maxlength= "255 "> &nbsp;&nbsp; <input   type= "checkbox "   id= "chk "   name= "chk "   value= "false "   onClick= "show(); "> 是否设定广告标题 </td>
                                </tr>


                                <tr>
                                    <td   colspan= "2 ">
    <table   width= "100% "     border= "0 "   cellspacing= "0 "   cellpadding= "0 "   class= "NormalText "   style= "display:none "   id= "tb ">
    <tr>
        <td   width= "17% "   height= "26 "   align= "right "> 广告语标题: </td>
        <td   width= "83% "> <input   type= "text "   size= "30 "   maxlength= "20 "   id= "EJSubject "   name= "EJSubject "> &nbsp;&nbsp; <font   color= "red "> (备注:E京标题字数不能超过20个字符) </font> </td>
    </tr>
</table>     </td>
                                </tr>

show()的函数为:
<script   language=javascript>
function   show(){
{
if(document.getElementById( "chk ").checked=true)
{
document.all[ "tb "].style.display= "block ";
}
else
{
document.all[ "tb "].style.display= "none ";
}
}
</script>

为啥出现错误呢?谢谢!

------解决方案--------------------
我测试了很正常,就把你的那段前后加上 <table> 封起来,如下:

<table>
<tr>
<td width= "80 " align= "right "> 主题: </td>
<td> <input name= "Subject " type= "text " id= "Subject " size= "30 " maxlength= "255 "> &nbsp;&nbsp; <input type= "checkbox " id= "chk " name= "chk " value= "false " onClick= "show(); "> 是否设定广告标题 </td>
</tr>


<tr>
<td colspan= "2 ">
<table width= "100% " border= "0 " cellspacing= "0 " cellpadding= "0 " class= "NormalText " style= "display:none " id= "tb ">
<tr>
<td width= "17% " height= "26 " align= "right "> 广告语标题: </td>
<td width=