473,416 Members | 1,546 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,416 software developers and data experts.

".Value" of dropdown box workin in firefox but not in IE. through javaScript

Hello Guys,
I have very strange problem . the attribute of drop down box(value) is perfectly running in firefox but it gives no value in Internet explorer.
So kindly suggest me wht to do?
Aug 13 '07 #1
11 3314
Logician
210 100+
Hello Guys,
I have very strange problem . the attribute of drop down box(value) is perfectly running in firefox but it gives no value in Internet explorer.
So kindly suggest me wht to do?
Try assigning values to the options.
Aug 13 '07 #2
pbmods
5,821 Expert 4TB
Heya, dhaval321.

The generally-accepted way to get the value of the selected option in a SELECT element is:
Expand|Select|Wrap|Line Numbers
  1. var select = {reference to the SELECT element};
  2.  
  3. var value = select.options[select.selectedIndex].value;
  4.  
Aug 13 '07 #3
Heya, dhaval321.

The generally-accepted way to get the value of the selected option in a SELECT element is:
Expand|Select|Wrap|Line Numbers
  1. var select = {reference to the SELECT element};
  2.  
  3. var value = select.options[select.selectedIndex].value;
  4.  

Hey pbmods.
I have tried through ur code also but again same problem it is running perfectly in mozilla firefox but it is not givin any value in Internet explorer..Now i m stuck wht to do..Do u have any other way around?
Aug 14 '07 #4
pbmods
5,821 Expert 4TB
Heya, dhaval321.

What does your HTML select tag look like?
Aug 14 '07 #5
Heya, dhaval321.

What does your HTML select tag look like?

Expand|Select|Wrap|Line Numbers
  1. function select()
  2. {
  3.     alert(document.frmCalculate.selectStudentName.value);
  4. }
Expand|Select|Wrap|Line Numbers
  1. <td height="46" width="229"><b><font color="#6699CC"> Select </font></b></td>
  2.             <td height="46" width="420">
  3.             <p align="left">&nbsp;<select size="1" name="selectStudentName" onchange="select()">
  4.             <option >Select 1 </option>
  5.             <option >Select 2 </option>
  6.                           <option >Select 3 </option>
  7.  
Hi as u can see the code..when user selects particular option from drop down box select() wil be called and shows the selected value..frmCalulate is the form name .. And it shows the selected value in the mozilla firefox but in Internet explorer alert box pops up but it contains no value
Aug 14 '07 #6
pbmods
5,821 Expert 4TB
Heya, dhaval321.

Thanks for posting your code.

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

Ok. Try this:
Expand|Select|Wrap|Line Numbers
  1. function select()
  2. {
  3.     var select = document.getElementsByName('selectStudentName')[0];
  4.  
  5.     alert(select.options[select.selectedIndex].value);
  6. }
  7.  
Expand|Select|Wrap|Line Numbers
  1. function select()
  2. {
  3.     alert(document.frmCalculate.selectStudentName.value);
  4. }
Expand|Select|Wrap|Line Numbers
  1. <td height="46" width="229"><b><font color="#6699CC"> Select </font></b></td>
  2.             <td height="46" width="420">
  3.             <p align="left">&nbsp;<select size="1" name="selectStudentName" onchange="select()">
  4.             <option >Select 1 </option>
  5.             <option >Select 2 </option>
  6.                           <option >Select 3 </option>
  7.  
Hi as u can see the code..when user selects particular option from drop down box select() wil be called and shows the selected value..frmCalulate is the form name .. And it shows the selected value in the mozilla firefox but in Internet explorer alert box pops up but it contains no value
Aug 14 '07 #7
yes
sure from next time i will follow that .. but ur code works same . mean workin in firefox and even in opera also but only it is not workin in Internet Explorer
Aug 14 '07 #8
pbmods
5,821 Expert 4TB
Heya, dhaval321.

Interesting. I'll go ahead and get some of our PC JavaScript Experts to look at this and see what they can come up with.
Aug 14 '07 #9
acoder
16,027 Expert Mod 8TB
Try assigning values to the options.
Follow Logician's advice. Your options don't have values. For example, you should have: [HTML]<option value="Select 1">Select 1</option>[/HTML]

PS. don't use names like select() for your functions. It can sometimes cause problems in IE and, in any case, it is bad practice.
Aug 14 '07 #10
ohh thx to all buddy,
For taking interest in this extra ordinary matter..Logisian is right have to declare value to option..Other browsers takes default but for internet explorer assigned value is must..thx to all and specially to logisian as well as pbmods and acoder..u guys helped me a lot to go further in my project
Aug 14 '07 #11
pbmods
5,821 Expert 4TB
Heya, dhaval321.

Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)
Aug 14 '07 #12

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

Similar topics

1
by: ouioui | last post by:
Hi, I try to have a communicatition between 2 windows In the first one i have a HTML styled select like that : <form name='addform' id='addform' action='add_dossier.php' method='post' >...
5
by: johnsuth | last post by:
I want to produce a trivial demonstration of dynamic modification. I thought that pressing a button might change its color. I studied O'Reillys books and successfully created the button with a...
2
by: jain_tj | last post by:
Could anyone please help me with the following problem My xml file is ============== <fig id="F0000001"> <caption>Caption text</caption> <image id="I0000001" image.class="halftone"...
2
by: Boki | last post by:
Hi All, // code start alert("document.all.txtbox"+valueA+".value") // end code could you please advice, can it show the value of txtbox ?
1
by: OtisUsenet | last post by:
Hi, I have a bookmarklet that works perfectly in Firefox, IE, Konqueror, and Opera, but in Safari 2.0.3 (417.9.2) it doesn't work. I enabled debugging and I can see "TypeError - Undefined...
2
by: riceyeh | last post by:
Hi, What does <xsl:if test="not($values)"mean? What I do not understand is $values? Here, means array? And . = $value means current node is equal to the variable value? So the total meaning is...
3
by: Harvey Triana | last post by:
Hi-- Sample. When i write something like: <input type="button" name="btnSend" value="Send" onclick="callSomeTask(getElementById('myControl').value );return false; /> I can run some cliente...
1
by: waltnixon | last post by:
I've got an MS Access query which runs fine when double clicked and returns all of the rows in a test database I'm building. I've set up a multi group report based on the query. I immediately...
1
by: ChollaPete | last post by:
This code: <form action="processScan.php" method="get"> <p> <?php print "Scan name: <input type=\"file\" name=\"tScanFileName\" value= \"{$scanFileName}\"><br>"; addHiddenCarryons(); ?>...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
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
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
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...

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.