@sh said the following on 3/22/2006 11:17 AM:
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
About my dilemma! I'm a bit stuck and have been toying all afternoon but
can't quite solve it - I think the reply from Erwin misunderstood my
question, either that or I misunderstood how to interpret his reply?
I basically need a way to, via onClick from another page element, set a
Select box to an option knowing only the 'value' of the Option in question?
You loop through the select options and when you find the one that has
the value you want, you set the selectedIndex to the one that has that
value. And, to get to the value, you have to know the selectedIndex.
function setSelectObject (val){
var selectObject = document.forms['myForm'].elements['mySelect'];
var k=0;
while (selectObject[k].value != val)
{
k++
}
selectObject.se lectedIndex = k;
}
It will pick up the first option that has the value that you pass it.
--
Randy
comp.lang.javas cript FAQ -
http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/