I have javascript code which passes select input form field values in Firefox and Opera but it does not seem to work in IE7.
This form runs a search, and the search results page has the same form at the top of the page with values filled in.
In Firefox the fields are passed correctly. In IE7 the select field "selected" option is not passed correctly, rather the drop-down select field reverts to the default/top field.
Here is the code: - <script language="javascript">
-
var arrQs = location.search.substring(1).split("&");
-
for (x = 0; x < arrQs.length; x++) {
-
if (arrQs[x].split("=")[0] == 'in_state') {
-
var val = arrQs[x].split("=")[1];
-
}
-
}
-
if (val != null) {
-
var e = document.forms[0].elements;
-
for (x = 0; x < e.length; x++) {
-
if (e[x].name && e[x].name == 'in_state') {
-
for (o = 0; o < e[x].options.length; o++)
-
if (e[x][o].value == val)
-
e[x][o].selected = true;
-
}
-
}
-
}
-
</script>
-
-
Thanks, Mike.
5 2333
Welcome to the site!
Do you get any errors? Can you show the HTML for the select element?
Thanks acoder!
The html code is actually formed by some perl scripts. Here is the way it appears on the page, sorry this may be a bit long. The screenshots show that Firefox displays the state abbreviation, while IE7 does not.
FIREFOX
IE7
Not tested, but adding values to the options should solve the problem:
[html]<option value="AK">AK[/html]
Seems to work, thank you very much!!!
You're welcome. Glad you've got it working. Post back to the forum if you have any more questions.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Paul |
last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and
session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
|
by: Fredrik/Sweden |
last post by:
Hi folks !
got this problem...
i have a table 'Accounts' in my database, which contains a bunch of
users. From the main menu i choose "edit user" and all users in the db
are presented in a table....
|
by: Forti2ude |
last post by:
Hello,
I have a simple form...
<form>
<select name="foo" multiple>
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
</select>
|
by: ddailey |
last post by:
I have a select named "s" in a form named "f":
By default only one of the options in the select appears on the page --
that is how I want it.
What I'd like to do is simulate a click on the...
|
by: Jan Doggen |
last post by:
Hello all,
I have a SELECT like this (the 'alert()s are temporary):
<FORM method="POST"
action="/scripts/runisa.dll?OVB2.132964:PGSPLITVACAFMELDEN:1095144287.9159"
id="hulpform"...
|
by: assgar |
last post by:
Hi
I am stuck on a problem.
I use 3 scripts(form, function and process).
Development on win2003 server. Final server will be linux
Apache,Mysql and PHP is being used.
The form displays...
|
by: Leena P |
last post by:
i want to basically take some information for the product and let the user
enter the the material required to make this product
1.first page test.php
which takes product code and displays...
|
by: CMani |
last post by:
Hi,
I have an select element which has hidden attribute for each of item.
Say Employee Id are listed in List Box, the Name and gender are kept in value and ATTRIB respectively for each code in...
|
by: mbcode |
last post by:
I am trying to use a Javascript picklist box and then echo the chosen values back to the screen (and insert in the db later) but I am getting the Button value rather than the list values. I have...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |