1

私はこのHTMLコードを持っています:

<form:form method="get" action="${pageContext.request.contextPath}/get_info">
    <table id="tabmenu">
        <tr>
            <td><input type="radio" name="choice" id="np" onClick="Affichenp();"/>Nomet Prenom</td>
            <td><input type="radio" name="choice"id="ns" onClick="Afficheppr();"/>Numérode somme</td>
            <td><input type="radio" name="choice" id="cn" onClick="Affichecin();"/>CIN</td>
        </tr>
        <tr>
            <td><input type="text" name="nom" id="nom" class="round default-width-input" /></td>
            <td><input type="text" name="ppr" id="ppr" class="round default-width-input" /></td>
            <td><input type="text" name="cin" id="cin" class="round default-width-input" /></td>
            <td><input class="button round blue image-right ic-right-arrow" type="submit" value=""></td>
        </tr>
    </table>
</form:form>

これは、javascript によって呼び出される関数のコードです。

<script type="text/javascript">

function Affichenp() {
    document.getElementById("nom").style.display = "block";
    document.getElementById("ppr").style.display = "none";
    document.getElementById("cin").style.display = "none";
}

function Afficheppr() {
    document.getElementById("nom").style.display = "none";
    document.getElementById("ppr").style.display = "block";
    document.getElementById("cin").style.display = "none";
}

function Affichecin() {
    document.getElementById("nom").style.display = "none";
    document.getElementById("ppr").style.display = "none";
    document.getElementById("cin").style.display = "block";
}

ラジオ ボックスをクリックすると、その下に入力が表示されるので、ラジオ ボタンをクリックするとテーブルの行数が変わります。つまり、最初に自分のページを開いたとき、入力が表示されないので、ラジオ ボタンを選択して入力を入力し、それを入力します...つまり、幅がtd変わります。解決策はありますか?

4

2 に答える 2

4

代わりにstyle.visibility = "hidden"andを使用してみてください。style.visibility = "visible"

于 2013-05-15T18:29:48.817 に答える