Jump to content

Magic of <DIV> Tag


shah_ankitb

Recommended Posts

I have made One Script. Which having Two Combo's One With having 'Country Name' & Another having it's Related 'State Name'.Suppose i want the Result without Refreshing the Page. So here is the Code Below. I will Sure it will help U in many Cases. Code is As Below....<form name="test"><select name="cmb" onchange="return showdata(this.value);"> <option value="">select</option> <option value="India">India</option> <option value="USA">USA</option> <option value="UK">UK</option></select><div id="gen_combo"></div></form></body></html><script>function showdata(val){ if(val == 'India'){ html = "<select><option>Gujarat</option><option>Delhi</option></select>"; }else if(val == 'USA'){ html = "<select><option>Chicago</option><option>Washington</option></select>"; }else{ html = "<select><option>London</option><option>ABC</option></select>"; } document.getElementById("gen_combo").innerHTML = html;}</script> If any one have Modification in this code to Make It more Userful for our Members then U r most Welcome.I am waiting for u'r valuable suggestions.

Link to comment
Share on other sites

Try adding an 'onClick' statment to the <select> tag, that runs the statment which looks up the related place.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...