473,387 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Javacript select option box

I have dynamic select option on my page that uses javascript and arrays to populate the option dropdown.
The problem is it is rendered on some user's browser and not on the others, everyone is using IE6 and above. Javascript is enabled too.
Please guide;
here is some code:

function cboDepartmentID_onchange() {
var ID = frm.cboDepartmentID.value;
var cbo = frm.cboUnitID;

//Shrink options back to the original one.
cbo.options.length = 1;
cbo.value = 0;
if (ID > 0) {

//Ignore Departments without any Units.
if (Units[ID] != null) {
for (l = 0; l < Units[ID].length; l++) {
o = document.createElement("option");
o.value = Units[ID][l][0];
o.text = Units[ID][l][1];
cbo.add(o);
}
}
}
}
May 1 '07 #1
2 1452
mrhoo
428 256MB
if you use createElement to make the option, use appendChild to add it to the select element:
cbo.appendChild(o);
and some versions of IE want the option appended to its select before they let you set the text and value.
May 1 '07 #2
r035198x
13,262 8TB
if you use createElement to make the option, use appendChild to add it to the select element:
cbo.appendChild(o);
and some versions of IE want the option appended to its select before they let you set the text and value.
If you can enable me to contact you through PM, mrhoo, I really need to get into contact with you , eh, privately.
May 2 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: JT | last post by:
I have an input form for which I've created a "matrix" for user input. Basically, the user chooses a radio button and then through javascript, a select box is displayed to define a value for that...
4
by: point | last post by:
Hello there... I'm a PHP programmer and starting to learn JS... I have a following problem.... I have 3 select boxes! one is hotel one is destination and one is country... if someone...
3
by: gekoblu | last post by:
Hi!, I want to fix via javascript the combo width to a fix value. I'd like to implement a kind of ALT / TITLE function to show the entire option when the text is longer than the combo width......
4
by: Marek Mänd | last post by:
This seems an IE issue only: 4253 bytes testcase: http://www.hot.ee/idaliiga/testcases/ieselect/bnlinkingselectinmsie.htm Can one have 1) a mouseover/mouseout element on TBODY 2) change in...
2
by: weiwei | last post by:
<% Option Explicit %> <!--#include file="includes/conn.inc"--> <% Dim rds, ID %> <% Set rds = Server.CreateObject("ADODB.Recordset") %> <% rds.Open "select RecID, LocationName from Location ORDER...
4
by: weiwei | last post by:
<% Option Explicit %> <!--#include file="includes/conn.inc"--> <% Dim rds, ID %> <% Set rds = Server.CreateObject("ADODB.Recordset") %> <% rds.Open "select RecID, LocationName from Location ORDER...
1
by: Ross | last post by:
On this page you will see the dropdown hides under the box. http://nationalservicesscotland.com/news/nss_news.php I use this javascript to fix the dropdown in ie // JavaScript Document
9
chunk1978
by: chunk1978 | last post by:
hey everyone, i've been trying to solve this problem for 2 days straight, with no end in sight. i would greatly appreciate anyone's help. EXPLANATION: There are 3 Select Menus. The 1st and...
2
by: dhillarun | last post by:
Hi All, I am passing ID of the HTML SELECT element to a javascript function. In that function I need to access the value selected in that select box. I tried the following code. but it didn't...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
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...
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...

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.