<script>
function Refresh()
{
if (document.getElementById("r1").checked)
{
document.getElementById("c").style.display = "none";
document.getElementById("p").style.display = "";
}
else
{
document.getElementById("p").style.display = "none";
document.getElementById("c").style.display = "";
}
}
</script>
<html>
<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><tr>
<td><INPUT type=text value="personal login name"></td>
<td><INPUT type=text value="personal password"></td>
</tr></table>
</html>

解决方案 »

  1.   

    <script>
    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>
    <html>
    <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>
    </html>
      

  2.   

    document.all.table[0].style.display="none";
      

  3.   

    <table>外加一层<div>
    用document.getElementById("DIV的ID名").style.display="none";显示
    用document.getElementById("DIV的ID名").style.display="";隐藏
      

  4.   

    谢谢上面两位,但我现在这个是在ASPX,用.NET开发的页面,而且,我按照你们写的改了后,还是报错啊也就是在
    if (document.getElementById("r1").checked)
    {
    document.getElementById("p").style.display = "none";
    document.getElementById("c").style.display = "";
    }
    没判断到document.getElementById("r1").checked,而且checked也点不出来,每次都是直接进行下面的那个一句
      

  5.   

    ASPX的radiobutton控件和普通的html控件不同,如果想在前台改变的话,所以建议你改用html控件