Javascript List Box(selection list)
I am using following code to add option to a list box
for (var i = 0; i < Engs.length; i++)
{if(document.dataform.PMPSA.value == Engs[i].PMPSANo)
{NewOpt = new Option;
NewOpt.value = Engs[i].No;
NewOpt.text = Engs[i].No + "-" + Engs[i].Description;
document.dataform.Engagement.options[document.dataform.Engagement.options.length] = NewOpt;
}
}
is it possible to select a particular option?
detox posted this at 00:05 — 20th November 2001.
They have: 571 posts
Joined: Feb 2001
option selected does this, the problem is where in the list you want it. Simply do a check for the i value of the option you want, and doc.write the option selected in.
this is the simple code that you want to end up with:
fsdfsdfasdfas
fsdfsdfasdfas
fsdfsdfasdfas
fsdfsdfasdfas
fsdfsdfasdfas
fsdfsdfasdfas
fsdfsdfasdfas
fsdfsdfasdfas
this one
fsdfsdfasdfas
fsdfsdfasdfas
If I have completely missed the intent of the question, i have to tell you I was out drinking pretty damn late last night!!!!!! so sorry!
Vincent Puglia posted this at 00:46 — 21st November 2001.
They have: 634 posts
Joined: Dec 1999
Hi dhaliwam,
Can't help but think I answered this somewhere else
document......Engagement.options.length] = NewOpt;
if (i == someNumber)
document....Engagement.options.length].selected = true;
Hi detox: lookin gooood, mon
Vinny
Where the world once stood
the blades of grass cut me still
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.