Hi Everyone,
I'm trying to get a check done in java script but i am very stuck and have no idea on how to go about it.
the idea behind it is to check the value of a dropdown menu so that when "other" is selected a text box appears in below to allow users to enter some information
here is the code
and the html to go with itCode:function otherFormCode(id){ var elem = document.getElementById(id); var servi = elem.selectedIndex; var otherBox = "<table>"; if (servi != 5){ otherBox = otherBox+"<tr><td>Other:</td><td><input type='hidden' name='otherbox' value='N/A' /></td></tr>"; document.form1.otherbox.innerHTML = otherBox; return otherBox; } else { otherBox = otherBox+"<tr><td>Other:</td><td><input type='text' name='otherbox' /></td></tr>"; document.form1.otherbox.innerHTML = otherBox; return otherbox } }
any help would be brilliantCode:<table class="upper"> <tr> <td>Trans Number</td> <td class="input"><input type="text" name="trans_id" id="trans-text" /></td> </tr> <tr> <td>Payment:</td><td class="input"><select name="payment" id="payment" onchange="otherFormCode('other')"> <option>--Please Select--</option> <option value="invoice">Invoice Payment</option> <option value="hardware">Hardware</option> <option value="software">Software</option> <option value="services">Services</option> <option value="other">Other</option> </select></td> </tr> <div id="otherbox"> </div>
Thanks
James



Reply With Quote

Bookmarks