+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

460 of 514 people (89%) answered Yes
Recently 4 of 10 people (40%) answered Yes


How can I add OPTIONs to a SELECT list?
How can I delete OPTIONs from a SELECT list?
I did not understand How to delete item from select online

Dec 18th, 2009 10:32
john mart, forum net tr, helmy mohameed, Fasee Uddin, Shopping Snooper, Casino Vendor Directory, Joe Bloggs, Jason David, chat alarab, sayal khan, seo webmaster, hindusthan jobs, osama said, kaka vijes, i can do it, diana b, Sam Thomas, Martin Honnen, Nathan Wallace, dharma gummi, http://www.www.onlineseosolution.com

You create a new OPTION with
  var opt = new Option('text', 'value');
and insert it with
  var sel = document.formName.selectName;
  sel.options[sel.options.length] = opt;
at the end of the SELECT list. To insert into the middle move other 
options up e.g.
  function insertOptionAt (select, option, index) {
    for (var i = select.options.length; i > index; i--)
      select.options[i] = select.options[i - 1];
    select.options[index] = option;
  // example call 
  insertOptionAt (document.formName.selectName, 
                  new Option('text', 'value'), 3);
You delete an OPTION simply be setting
  var sel = document.formName.selectName;
  sel.options[optionIndex] = null;
Note that NN2/3/4 on windows and mac will insert/delete the option 
way but not update the screen display of the SELECT unless you call
So do all your changes to a SELECT and then call
  if (navigator.appName == 'Netscape' && 
      (navigator.appVersion.indexOf('Win') != -1 ||
       navigator.appVersion.indexOf('Mac') != -1))
to get the display updated if necessary. Be aware that calling 
history.go(0) reloads the document so make sure your code adding or 
deleting options is NOT called in BODY ONLOAD as then you get an 
infinite loop.
Alternately, you can resize the window by a pixel and resize it back, 
which has the same effect without forcing a complete reload of the 
IE4/5 and NN6 have other ways of inserting and deleting OPTIONs 
into/from a SELECT but the above code is cross browser and therefore 
recommended unless you are sure you target only a particular browser.
full program full oyun http://www.forumnettr.com
full forum http://www.forumnettr.com/forum 
secilmis youtube videolari http://www.youtubevideolari.net youtube videos
online video tr tube http://www.videotrtube.com
firmalar sirketler rehberi http://www.sirketfirmarehberi.com firma
sirket rehberi adres telefon bilgileri
online vieo izle videoturk izle http://www.videoturk.gen.tr