By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,988 Members | 1,049 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,988 IT Pros & Developers. It's quick & easy.

dynemic dropdown on two select -How do you go about creating two dropdown boxes such

P: 1
Expand|Select|Wrap|Line Numbers
  1. <head><script type="text/javascript" src="http://bytes.com/script.js"></script></head> <form  name="buy" action="http://bytes.com/purchase"> <div> <center> <br/><br/><br/><br/> <table> <tr><td> <h3>Product1*</h3></td> <td><select name="pname" onchange="car(document.buy.pname.options[document.buy.pname.selectedIndex].value);"> <option value="">---brand---</option> <option value="1">Maruti</option> <option value="2">Tata</option> <option value="3">BMW</option></select></td> <td> <h3>****Modal*</h3></td> <td><select name="modal"> <option value="">---select---</option> </select> </td> </tr></table></center></div></form>
  2.  
  3.  
  4. and script.js
  5.  
  6. function car(selobj,newobj)
  7. {var t=document.purchase.modal;
  8.     t.options.length=0;
  9.     if(chosen==="")
  10.         {
  11.              t.options[t.options.length] = new Option('---select---','');
  12.         }
  13.         if(chosen==="1")
  14.             {
  15.                  t.options[t.options.length] = new
  16. Option('800','11');
  17.   t.options[t.options.length] = new
  18. Option('alto','12');
  19.             }
  20.              if(chosen==="2")
  21.             {
  22.                  t.options[t.options.length] = new
  23. Option('nano','21');
  24.   t.options[t.options.length] = new
  25. Option('nano lxi','22');
  26.             }
  27.              if(chosen==="3")
  28.             {
  29.                  t.options[t.options.length] = new
  30. Option('murcdies','31');
  31.   t.options[t.options.length] = new
  32. Option('bmw 123','32');
  33.             }
  34. }
my output is not respond........please do some help
thanks......
Jul 5 '14 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.