473,387 Members | 1,545 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.

How to get a selected value from <Select> using DOM

Hi All,

Can any one help me, how to get the selected value from <Select> tag
using DOM
I tried with
document.getElementById("selectTagId").getAttribut e("value") it's
working fine with IE but not with NN I have checked it on NN 7.1

Thanks in advance

Jul 20 '05 #1
1 164529
Raghuram Banda <ra************@nokia.sify.net> writes:
Can any one help me, how to get the selected value from <Select> tag
using DOM I tried with
document.getElementById("selectTagId").getAttribut e("value") it's
working fine with IE but not with NN I have checked it on NN 7.1


document.getElementById("selectTagId").value
works in modern browsers. For Nestscape 4 and other old browsers,
you must get the value from the selected option (works in newer
browsers too):

var sel = document.getElementById("selectTagId");
sel.options[sel.selectedIndex].value;

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

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

Similar topics

2
by: Mad Scientist Jr | last post by:
I'm trying to get javascipt select all items in a HTML form <SELECT> control and submit the form to an asp.net page. For some reason when the link is clicked, you can see the items all get...
2
by: Laphan | last post by:
Hi All Could you please confirm what the syntax is to change the style of a <SELECT> box using CSS. I basically want to take the 3D effect off this box, but it doesn't seem to be possible...
6
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...
1
by: ghadley_00 | last post by:
Hi, I have a php form that encodes the responses to various <Select> field drop down menus as numbers (e.g. 0 to 50), and then posts the data to a MySQL table. I am trying to implement a form...
5
by: = poster = | last post by:
Hi all , I have a script which let the user choose between four days : Day: <select name=\"day\" value=\"$day\"> <option value=\"01\">1</option> <option value=\"02\">2</option> <option...
8
by: jason1987 | last post by:
I have created a drop down box, which works fine, i want to increase the number of rows it shows without having to scroll, how do i do this though? <td><select name="itjobtypeid"...
12
by: LayneMitch via WebmasterKB.com | last post by:
Hello everyone. I'm currently learning Javascript and doing a few exercises. One problem I'm working on takes an array of names from an xml file using Ajax and writes it to...
14
mikek12004
by: mikek12004 | last post by:
In a form I have 5 elements (e.g. pictures) and I wish for the user to be able to set the order of appearance. For this I have for each picture a select box (names select1 to select5) with "please...
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: 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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
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,...
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.