Validation script only firing once & can't select specific radio parent div
<p>I am struggling to get a couple of javascripts scripts to work properly.</p>

<p>The first is a simple validation script on the textbox. It works once but if you hit the submit a second time you can proceed without entering anything. How do I make the script to fire (and work) every time the submit button is clicked?</p>

<p>The second thing I'm trying to do is get a div class to change based on a radio click . The problem is that because all the radio buttons share the same id/name it always changes the first radio button background no matter which radio button was clicked. How do I get it to change the class of the div containing it?</p>

<p>HTML looks like (with the javascript in the head tags as shown...</p>

<pre><code>&lt;head&gt;
&lt;link href="/css/0051.css" rel="stylesheet" type="text/css" /&gt;

&lt;script type="text/javascript"&gt;

function validateForm() {
        var x=document.forms["form"]["txtbox_1501"].value;
    if (x==null || x=="" || x=="Please type your answer in this box")
    {
        document.getElementById("txtbox_container").id = "txtbox_err";
        document.getElementById("ques_txt").className = "ques_txt_err";
        document.getElementById("ques_inst").className = "ques_inst_err";
        return false;
    }
}

function radioDiv() {
    document.getElementById("radio_label").className = "radio_input_selected";
}

&lt;/script&gt;

&lt;/head&gt;

&lt;body&gt;


&lt;form id="form" name ="form" action="/php/process.php" onsubmit="return validateForm()"  method="post"&gt;

&lt;div id="txtbox_container"&gt;
       &lt;div id="ques_container"&gt;
          &lt;a id="ques_txt" class="ques_txt"&gt;Please tell us your name:&lt;/br&gt;&lt;/a&gt;
          &lt;a id="ques_inst" class="ques_inst"&gt;(How you would like to be referred to in this demo)&lt;/br&gt;&lt;/a&gt;
       &lt;/div&gt;
       &lt;div id="txtbox_input"&gt;
          &lt;input type="text" name="txtbox_1501" value="Please type your answer in this box" onfocus="if(!this._haschanged){this.value=''};this._haschanged=true;" /&gt;&lt;/br&gt;
       &lt;/div&gt;
    &lt;/div&gt;

    &lt;div id="radio_container"&gt;
       &lt;div id="ques_container"&gt;
          &lt;a class="ques_txt"&gt;What is your gender?&lt;/br&gt;&lt;/a&gt;
          &lt;a class="ques_inst"&gt;(Are you female or male?)&lt;/br&gt;&lt;/a&gt;
       &lt;/div&gt;
       &lt;label&gt;
          &lt;div id="radio_label" class="radio_input"&gt;
             &lt;input type="radio" name="radio_1503" value="2" onclick="return radioDiv()" /&gt;
             &lt;a class="radio_label"&gt;Female&lt;/a&gt;
          &lt;/div&gt;
       &lt;/label&gt;
       &lt;label&gt;
          &lt;div id="radio_label" class="radio_input"&gt;
             &lt;input type="radio" name="radio_1503" value="1" onclick="return radioDiv()" /&gt;
             &lt;a class="radio_label"&gt;Male&lt;/a&gt;
          &lt;/div&gt;
       &lt;/label&gt;&lt;/div&gt; 
&lt;/div&gt;      

&lt;div id="button"&gt;
   &lt;input type="submit" class="submitbutton" value=""/&gt;

&lt;/div&gt;  

    &lt;/form&gt;

&lt;/body&gt;
</code></pre>

<p>Any suggestions would be gratefully received. Thanks.</p>
