i have an html form. in it, there is a list of radio buttons, the last of which is 'other'. i have a text input that is to be disabled unless the 'other' radio button is selected. however, i can't seem to get the javascript to work.
here's the form:
and the javascript:HTML Code:<form name="contact" action="process.php" method="post"> <label class="text">Name:<input class="name" name="name" type="text" value="" /></label><br /> <label class="text">Email:<input class="email" name="email" type="text" value="" /></label><br /> <label class="text">Subject:<input class="sub" name="sub" type="text" value="" /></label><br /> <label class="text">Purpose:</label><br /> <label class="button"><input class="purpose" id="1" name="purpose" type="radio" value="Job Offer" onchange="radio_checker();" />Job Offer</label><br /> <label><input class="purpose" id="2" name="purpose" type="radio" value="Question/Comment" onchange="radio_checker();" />Question/Comment</label><br /> <label><input class="purpose" id="3" name="purpose" type="radio" value="Other" onchange="radio_checker();" />Other</label> <input class="purposeOther" id="4" name="other" type="text" value="" disabled="true" /><br /> <label class="msg">Message:<textarea class="msg" name="msg" value=""></textarea></label> <a href="javascript:submit();" class="submit">Send</a> <a href="javascript:reset();" class="reset">Reset</a> </form>
please help.Code:function radio_checker() { if (document.contact.3.checked) { document.contact.purposeOther.disabled = false; document.contact.purposeOther.focus(); } else { document.contact.purposeOther.disabled = true; } }


LinkBack URL
About LinkBacks

Reply With Quote
