日期:2014-05-16  浏览次数:20346 次

菜鸟关于隐藏table的问题
目的就是两个BUTTON,一个隐藏TABLE,一个显示。
<script   language= "javascript ">
function   Refresh()
{
if   (document.getElementById( "r1 ").checked)
{
document.getElementById( "p ").style.display   =   "none ";
document.getElementById( "c ").style.display   =   " ";
}
else
{
document.getElementById( "c ").style.display   =   "none ";
document.getElementById( "p ").style.display   =   " ";
}
}
</script>
<INPUT   type= "radio "   id= "r1 "   name= "radio "   CHECKED   onclick= "Refresh() "> company   <INPUT   type= "radio "   id= "r2 "   name= "radio "   onclick= "Refresh() "> personal
<table   id= "c ">
<tr>
<td> <INPUT   type= "text "   value= "company   login   name "> </td>
<td> <INPUT   type= "text "   value= "company   password "> </td>
</tr>
</table>
<table   id= "p "   style= 'DISPLAY:none '>
<tr>
<td> <INPUT   type= "text "   value= "personal   login   name "> </td>
<td> <INPUT   type= "text "   value= "personal   password "> </td>
</tr>


------解决方案--------------------
display属性对于table标签来说是只读的。
在table外面再套个div吧。
------解决方案--------------------
<script language= "javascript ">
function Refresh()
{
if (document.getElementById( "r1 ").checked)
{
document.getElementById( "p ").style.display = "none ";
document.getElementById( "c ").style.display = " ";
}
else
{
document.getElementById( "c ").style.display = "none ";
document.getElementById( "p ").style.display = " ";
}
}
</script>
<INPUT type= "radio " id= "r1 " name= "radio " CHECKED onclick= "Refresh() "> company <INPUT type= "radio " id= "r2 " name= "radio " onclick= "Refresh() "> personal
<table id= "c ">
<tr>
<td> <INPUT type= "text " value= "company login name "> </td>
<td> <INPUT type= "text " value= "company password "> </td>
</tr>
</table>
<table id= "p " style= 'DISPLAY:none '>
<tr>
<td> <INPUT type= "text " value= "personal login name "> </td>
<td> <INPUT type= "text " value= "personal password "> </td>
</tr>
</table>
------解决方案--------------------
<script>
function Refresh()
{

if (document.getElementById( "p ").style.display== "none ")
{
document.getElementById( "p ").style.display = " ";

}
else
{