473,791 Members | 3,105 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SELECT Element in FireFox

1 New Member
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 the list box .

I want to display the Code, Name and gender of the selected Employee, so i wrote on change event for the select element and invoke the javascript to populate the values to the corresponding input text box.

The Html Code is
[html]
<html>
<head>
<script language = "javascript ">
function selChange()
{
var frm = document.frmSel
frm.txt_Selecte d_Value.value = frm.sel_Select. options[frm.sel_Select. selectedIndex].value
frm.txt_Selecte d_Text.value = frm.sel_Select. options[frm.sel_Select. selectedIndex].text
frm.txt_Selecte d_Attribute.val ue = frm.sel_Select. options[frm.sel_Select. selectedIndex].ATTRIB
}
</script>
</head>
<body>
<form name = "frmSel">
Code
<select name = "sel_Select " onchange = "selChange( )">
<option ATTRIB = "Male" value = "M Clarke">Clarke</option>
<option ATTRIB = "Female" value = "H Flora Watson">Flora</option>
<option ATTRIB = "Male" value = "P Ricky">Ricky</option>
</select> <BR>
Selected Text : <input type = "text" name = "txt_Selected_T ext" size = "10"> (Code) <BR>
Selected Value : <input type = "text" name = "txt_Selected_V alue" size = "20"> (Name) <BR>
Selected Attribute : <input type = "text" name = "txt_Selected_A ttribute" size = "10"> (Gender)

</form>
</body>
</html>
[/html]
This above code works fine with IE7.

But in FireFox 2.0 the gender is displayed as "undefined" .

Pl. give some tip on how to achieve the same result of IE in FireFox.

Advance Thanks for your timely help.
Sep 27 '07 #1
1 4872
drhowarddrfine
7,435 Recognized Expert Expert
Three things. First, there is no such thing as
<script language="javas cript"> anymore.
The correct syntax is <script type="text/javascript">

Second, make sure you are using a proper, strict doctype to get IE to attempt to behave like modern browsers do. See the article about doctypes under Articles above.

Third, this is a javascript question so I will transfer this there.
Sep 27 '07 #2

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

Similar topics

6
3018
by: Omar | last post by:
Hi, In a JSP I have the next: .... codigo = "<select name='" + nombre + "'>\n<option selected value='default'>Escoge</option><option value='todos'>Todos</option>"; if (miRS != null) while (miRS.next()) {
4
8640
by: Michael Schuerig | last post by:
I'm trying to change the options of a select element by setting its innerHTML. Here's a demo case: <html> <head> <script language="javascript" type="text/javascript"> function addOpts() { var s = document.getElementById("s"); s.innerHTML = '<option>Opt1</option><option>Opt2</option>'; }
11
5439
by: lkrubner | last post by:
I'm facing an extremely irksome bug in FireFox. This select tag is not rendering quite right. When I click on it to choose a color, it shows a scroll tab, but the scroll only goes down to the 43 option and ends with f0f. However, I find that when I use the arrow keys, I can still walk through the whole list. It just isn't visible. Considering the javascript involved, this is a limiting bug. Text color: <select...
11
1535
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 select so that all of its options become visible -- i.e., its option box opens to reveal all document.f.s.options.length options. I've tried the following:
1
2813
by: kebabkongen | last post by:
Hi, I'm working on a JavaScript that is enabling / disabling a select element according to whether a checkbox is selected or not. This works fine in Firefox, but in Internet Explorer (v 6.0.2900) it appears wierd: When I disable the selevt element in IE, it continues to appear as enabled (falsely) until I try changing it. When I click on it, updates itself as grey as to indicate that it is disabled.
4
2278
by: Ian Richardson | last post by:
Hi, The function I've put together below is a rough idea to extend a SELECT list, starting from: <body> <form name="bambam"> <select id="fred"> <option value="1">1</option> <option value="2">2</option>
7
2477
by: Zhang Weiwu | last post by:
Dear all How does javascript realiablily tell if a variable is a reference to an HTML Element "<select>", without causing browser to pop up error message? if (variable.constructor == HTMLElementSelect) // doesn't work, Firefox complain no such property if variable is undefined if (typeof variable == "object" && variable.constructor == HTMLElementSelect) // doesn't work, IE complain object do not have this property "constructor"
4
5369
by: Patrick Nolan | last post by:
I am using javascript to manipulate optgroups in select elements. When the results are displayed in Firefox 2.0 there is an annoying blank line at the top of the multi-line select box. This doesn't happen with IE7. There's a little program below which illustrates the problem. I create two multi-line select boxes. The first one has an optgroup and an option specified in the HTML. That one displays with "opt1" as the first line. The...
5
2025
by: Gregor Kofler | last post by:
Refactoring my old DualSelectBox , I thought it would be much smarter to get rid of the new Option() stuff, and instead just switch childNodes between the two select elements. Something like that: function shiftSelectedOptions(src, dest) { var i, len, opts = ; for(i = 0, len = src.options.length; i < len; i++) { if (src.options.selected) { opts.push(src.options); }
0
9515
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10207
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9029
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5431
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4110
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 we have to send another system
2
3718
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.