473,473 Members | 1,546 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Question about SELECT element

Hi, all

On a SELECT object, I try to set it's value with one of the value of
options, such as selectObj.value="whatever". Sometime it works while
sometimes it won't work at all , using IE6. When we want to set a value to
the SELECT object, have to know it's option index first. Then set
selectedIndex to that index. Is there a quick way to set a select value with
a known value?

Jack
Jul 23 '05 #1
2 968
datactrl wrote:
Is there a quick way to set a
select value with a known value?


There is no "quick" way. You need to cycle through all the options, find the
option (or options) that have a value matching yours, and mark them as
selected.

You can hide this all in a general function, though, which I find to be most
convenient.
Then, using functions from http://www.mattkruse.com/javascript/validations/
for example, you can just do:

setInputValue(document.forms[0].selectObj,"myValue");

and this will work regardless of input type.

--
Matt Kruse
Javascript Toolbox: http://www.mattkruse.com/javascript/
Jul 23 '05 #2
Thanks, Matt. It's a big help.

Jack
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Paul Bramscher | last post by:
Here's one for pathological SQL programmers. I've got a table of things called elements. They're components, sort of like amino acids, which come together to form complex web pages -- as nodes...
13
by: Martin | last post by:
I have 5 days of experince with XSLT and I am sure my problem is pretty much as basic as they come but I cannot work it out, so I hope someone will take pity on me - please! I have inherited an...
3
by: rene | last post by:
Hello everybody, i have these 2 xml files ------1.xml------ <?xml version="1.0" encoding="UTF-8"?> <root> <element>1</element> <element>2</element> </root>
1
by: Scott | last post by:
The following is the XML I have to work with. Below is the question <Table0> <CaseID>102114</CaseID> <CaseNumber>1</CaseNumber> <DateOpened>2005-06-14T07:26:00.0000000-05:00</DateOpened>...
1
by: Nicolas Van Lancker | last post by:
Hi folks; I have this webpage, allowing users to insert multiple records in one post into the database. Because I don't know the exact number of records they want to add, I created a little...
3
by: Jim Heavey | last post by:
Hello I am working through a littel tutorial on XSL and I have a "simple" question. I am wanting to build a table with headings of the lement names. The tutorial show that I am to use the...
6
by: dave | last post by:
I really have 2 questions regarding the following xml snippet. The xml is a directory representation. <?xml version="1.0" standalone="yes"?> <FileSystem> <Row> <ID>1</ID> <Name>Root</Name>...
1
by: Ganesh Muthuvelu | last post by:
Hello all, I have a XML as below: ****************** <BLOCK> <ROW1> <A>1</A> <B>2</B> </ROW1> <ROW2>
3
by: Italio Novuas | last post by:
Hi all, let me begin by saying that I *ALMOST* have this complete! What I'm trying to do is make it so my text area shows the innerHTML of any select item with the same value. For example, if I...
8
by: =?Utf-8?B?TWFyaw==?= | last post by:
Here are three things that I thought would be equivalent but are not. Just wondering why: XmlElement foo = doc.CreateElement("foo"); // load it up with a body xslt.Transform (foo, null, new...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.