单选按钮焦点

时间:2011-03-16 08:27:00

标签: javascript radio-button

<html>   
    <head>   
        <script>   
            function goSubmit()   
            {   
                document.frm.submit();   
            }   
        </script>   
    </head>   
    <body>   
        <form action ="view1.jsp" method="post" name="frm">   

            <table>   
                <tr>   
                    <td>   
                        <input type="radio" name="rg" value="faculty" onClick="goSubmit()"/>   
                    </td>   

                    <td>   
                        <input type="radio" name="rg" value="date"  onClick="goSubmit()"/>   
                    </td>   

                    <td>   
                        <input type="radio" name="rg" value="content"  onClick="goSubmit()">   
                    </td>   
                </tr>   
            </table>   
        </form>   
    </body>   
</html>

1 个答案:

答案 0 :(得分:0)

试试这个:

<html>
<head>
<script>
    function goSubmit() {
        document.forms.frmTest.submit();
    }
</script>
</head>
</html>
<body>
    <form action="/process.php" method="get" name="frmTest">
        <table>
            <tr>
                <td>
                    <input type="radio" name="rg" value="faculty" onClick="goSubmit();"/>
                </td>

                <td>
                    <input type="radio" name="rg" value="date" onClick="goSubmit();"/>
                </td>

                <td>
                    <input type="radio" name="rg" value="content" onClick="goSubmit();">
                </td>
            </tr>
        </table>
    </form>
</body>