robert_gsfame Posted March 22, 2010 Share Posted March 22, 2010 I have 3 combobox, 1 combobox has been set first but the other 2nd combobox will depend on the 1st while the 3rd will depend on the 2nd combobox here is the javascript code: function showcity() { if (document.form1.country.value == "USA"){document.getElementById('mycity').innerHTML = "<select name='city' onchange='showaddress()'><option value='nocity' id='nocity'>Please choose city</option><option value='LA' id='LA'>Los Angeles</option>"} if (document.form1.country.value == "none"){document.getElementById('mycity').innerHTML = ""} if (document.form1.country.value == "none"){document.getElementById('myaddress').innerHTML = ""} } function showaddress() { if (document.getElementById("LA")){document.getElementById('myaddress').innerHTML = "<select name='address'><option value="noaddress">Please choose address</option><option value='rose'>Rose street</option></select>"} if(document.getElementById("nocity")){document.getElementById('myaddress').innerHTML = ""} } html code: <form name="form1"> <select name="country" onchange="showcity()"> <option value="none">Please choose at least one</option> <option value="USA">USA</option> <div id="mycity"></div> <div id="myaddress"></div> </form> The problem is when i choose "nocity", the 3rd combobox should disappear but it is not....may be there is something missing with the bold one?? thanks Link to comment https://forums.phpfreaks.com/topic/196126-dynamic-combobox-problem/ Share on other sites More sharing options...
robert_gsfame Posted March 23, 2010 Author Share Posted March 23, 2010 ;D ;D got it...i must return the value first......YAHOOOOOOOOOO!!! Link to comment https://forums.phpfreaks.com/topic/196126-dynamic-combobox-problem/#findComment-1030304 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.