Jump to content

Dynamic Drop Down Select box


alwaysvaghu

Recommended Posts

Dynamic Drop Down Select boxHello Friends....I want to cretae dynamic dropdown select box....like....when it should save entered value in drop down list and also allow usto enter new value if it is not in the list.....How can I do that...????

Link to comment
Share on other sites

Ok, so you've posted this message in general, html, css, javascript and php section. That's borderline spamming. Post it once, in one forum, and people will see it. If you post it in the html forum, and some javascript is required for your menu, it doesn't matter, cause people can still post the code needed in that one thread. It's just general javascript questions go in the javascript forum etc. So, no need to post it in every forum... Just something to remember...

Link to comment
Share on other sites

Ok man I got it... :D It will be my first n last mistake.... :( i think so... :)

Hey man, don't worry about it. It was just meant as a friendly reminder, but I guess it sounded a bit angry. Sorry about that... :)
Link to comment
Share on other sites

I've done it with vbasic, but never with javascript. :ph34r:Maybe you could use the same concept as creatign a table row with an outside function.

Link to comment
Share on other sites

You can use "new Option()" to add values to a select list.

<script type="text/javascript">function addOption(objS, v){  if(v == '' || v != 'Add') return;  var slen = objS.options.length;  var temp = prompt('What is your favorite color?', 'Dark Blue');  if(!temp) return;  objS.options[slen] = new Option(temp, temp);  objS.selectedIndex = slen;}</script>  </head><body><form>Your Favorite Color: <select name="sel" onchange="addOption(this, this.value)"><option value="">Pick One<option value="Red">Red<option value="Blue">Blue<option value="Green">Green<option value="Add">Add Yours</select></form>

Thanks,

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...