2012-02-16 11 views
0

私はドロップダウンリストとドロップダウンリストの値に基づいて表示と非表示のテキストを持つPHPフォームを持っています。問題は、[送信]ボタンをクリックしたときに、オンロード機能の作業とテキストの非表示のバリデーションエラーです。ドロップダウンリストに応じて表示または非表示にしておく必要があります。ここでJS show hide投稿をクリックしたときに表示されます

はイムがやって何です:負荷に体にここにhidefield関数を呼び出す

<script type="text/javascript"> 

    function showfield(name){ 
    if(name != 'High School') 
    document.getElementById('div1').style.display="block"; 
    else 
    document.getElementById('div1').style.display="none"; 
    } 

    function hidefield() { 
    document.getElementById('div1').style.display='none'; 
} 
<script> 

イム:

ドロップdownlist

<select name="education" size="1" class="text" id="education" onchange="showfield(this.options[this.selectedIndex].value)"> 

<body onload = "hidefield()"> 

およびその他の機能誰かが助けてくれることを願っています

+0

任意のアイデアをごhidefield機能を変更しますか?私が望むようにまだ動作していません – user1084949

答えて

0

ただ、それは

function hidefield() { 
    var select = document.getElementById("education"); 
    if (select.options[select.selectedIndex] != 'High School') 
     document.getElementById('div1').style.display='none'; 
} 
+0

私は隠し機能を変更しましたが、同じことが起きました,,,テキストボックスは私がclichを提出すると非表示にします – user1084949

0

スクリプトは、終了タグが欠落している必要がある場合にのみ、それを隠すために、私はこの問題を解決する方法を

</script> after the function hidefield() 
+0

終了タグはここで逃しました,,,それでも解決するのを待っています – user1084949

関連する問題