Entry
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
Jan 31st, 2010 16:04
forum net tr, helmy mohameed, Hindusthan Jobs, john mart, Fasee Uddin, Shopping Snooper, Casino Vendor Directory, Joe Bloggs, Jason David, chat alarab, sayal khan, seo webmaster, 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
that
way but not update the screen display of the SELECT unless you call
history.go(0)
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))
history.go(0);
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
page.
Example:
window.resizeBy(1,1);
window.resizeBy(-1,-1);
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
http://www.hindusthanjobs.com (Jobs In Jaipur Rajasthan )