473,320 Members | 1,982 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,320 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 3311
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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.