Current location: Hot Scripts Forums » General Web Coding » JavaScript » onChange with 2 values not working in FireFox


onChange with 2 values not working in FireFox

Reply
  #1 (permalink)  
Old 07-09-05, 10:27 AM
dooby dooby is offline
New Member
 
Join Date: Jul 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
onChange with 2 values not working in FireFox

Hello,

I'm trying to do an onchange in the dropdown options but unfortunately it only works in IE and not in firefox, how is it possible to make it work in firefox?

Part of Code:

Code:
<form method="post" action="*****.php">
<SELECT NAME='country' class='inputbox' onChange="areacode.value=this[this.selectedIndex].value2">

         <OPTION value2="" VALUE=''>---- Select here ----</OPTION>

             <option value2="93" value="1" >Afghanistan</option>
<option value2="355" value="2" >Albania</option>
<option value2="213" value="3" >Algeria</option>

<option value2="684" value="4" >American Samoa</option>
<option value2="376" value="5" >Andorra</option>
<option value2="244" value="6" >Angola</option>
<option value2="1264" value="7" >Anguilla</option>
<option value2="672" value="8" >Antarctica</option>
<option value2="1268" value="9" >Antigua And Barbuda</option>
<option value2="54" value="10" >Argentina</option>
<option value2="374" value="11" >Armenia</option>
<option value2="297" value="12" >Aruba</option>
         </SELECT>

<input type="text" size="2" name="areacode" DISABLED>
</form>
I need the value2 to be entered in the textbox and not necessary to be submitted to the form, but the value should be submitted, when I try this code on Firefox on each select I get undefined, but it works on IE. So what's the solution for firefox. Please help

Regards,
Reply With Quote
  #2 (permalink)  
Old 07-09-05, 11:32 AM
Keith's Avatar
Keith Keith is offline
Community Liaison
 
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
Lots of stuff wrong with even the HTML in that code.

To get you started:

value2="" is not a legal attribute, it should (i assume) be name="value2"

Try naming your form, then changing the javascript to
document.form_name.areacode.value=document.form_na me.value2.value
Reply With Quote
  #3 (permalink)  
Old 07-09-05, 12:05 PM
dooby dooby is offline
New Member
 
Join Date: Jul 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Hello, I don't understand what you mean. Can you please modify the code with your suggestion?
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Auto Dealer Script nuzzle PHP 17 04-14-10 08:34 PM
IE and Firefox not working together stuboo CSS 2 11-29-04 02:49 AM
calendar working until months changed bitesize JavaScript 1 01-13-04 01:50 PM
MySQL table problem perleo PHP 9 12-16-03 01:16 PM
asp: values in array not in order?? seala ASP 0 08-16-03 12:06 PM


All times are GMT -5. The time now is 10:49 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.