jdubwelch Posted April 11, 2006 Share Posted April 11, 2006 I'm not too familiar with java, i know what it can do but I'm not that good with it, I'm more into php. Anyways, I have 2 radio buttons:1) Ship to address listed above <selected>2) Ship to this addressHow would I make it so when a person changes to "ship to this address", the fields to enter a new address will show up?a demo of what the two radio buttons, and form below to show up are at:[a href=\"http://www.jwelchdesign.com/ao/book/onchange.php\" target=\"_blank\"]http://www.jwelchdesign.com/ao/book/onchange.php[/a]the code for the form:[code]<form><input name="dvd_ship" type="radio" id="dvd_ship" value="same" checked>Ship to address listed above<br><input name="dvd_ship" type="radio" id="dvd_ship" value="new">Ship to this address: <br><br>ADDRESS:<br><input name="dvd_shipping_address" type="text" id="dvd_shipping_address" size="25"><br><br>City<input name="dvd_shipping_city" type="text" id="dvd_shipping_city" size="15"><select name="dvd_shipping_state" class="mainText" id="dvd_shipping_state"> <option value="State">St </option> <option value="Oregon">OR </option> <option value="Washington">WA </option> <option value="California">CA </option> <option value="Idaho">ID</option> <option value="Colorado">CO</option> <option value="Nevada">NV</option></select>ZIP<input name="dvd_shipping_zip" type="text" id="dvd_shipping_zip" size="8"></form>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/7130-onchange-show-table-help/ Share on other sites More sharing options...
wildteen88 Posted April 12, 2006 Share Posted April 12, 2006 Something like this should do the trick:[code]<script type="text/javascript">function showHide(inID) { theObj = document.getElementById(inID); theDisp = theObj.style.display == "none" ? "block" : "none"; theObj.style.display = theDisp;}</script><form><input name="dvd_ship" type="radio" id="dvd_ship" value="same" onChange="showHide('ship_addy')" checked>Ship to address listed above<br><input name="dvd_ship" type="radio" id="dvd_ship" value="new" onChange="showHide('ship_addy')">Ship to this address:<br><br><div id="ship_addy" style="display: none">ADDRESS:<br><input name="dvd_shipping_address" type="text" id="dvd_shipping_address" size="25"><br><br>City<input name="dvd_shipping_city" type="text" id="dvd_shipping_city" size="15"><select name="dvd_shipping_state" class="mainText" id="dvd_shipping_state"> <option value="State">St </option> <option value="Oregon">OR </option> <option value="Washington">WA </option> <option value="California">CA </option> <option value="Idaho">ID</option> <option value="Colorado">CO</option> <option value="Nevada">NV</option></select>ZIP<input name="dvd_shipping_zip" type="text" id="dvd_shipping_zip" size="8"></div></form>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/7130-onchange-show-table-help/#findComment-26123 Share on other sites More sharing options...
jdubwelch Posted April 12, 2006 Author Share Posted April 12, 2006 thanks... it worked! Can you comment on the javascript part. Just to see what everything is doing. Quote Link to comment https://forums.phpfreaks.com/topic/7130-onchange-show-table-help/#findComment-26280 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.