Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make Javascript that works in Firefox work in IE as well? 1

Status
Not open for further replies.

Argonto

Technical User
Mar 17, 2011
23
0
0
US
I have this code That works in firefox but not in IE. i adapted it, from some previous code that used a radio button to assign values to a field. It now uses a Drop-down Box, it worked perfectly in Firefox, but doesn't in IE.

Here Is the Code:
<SCRIPT language=javascript type=text/javascript>

function set_pricetag(rad_obj)
{
var PriceA=document.getElementById('value1');
var PriceB=document.getElementById('value2');
var PriceC=document.getElementById('value3');
var date=document.getElementById('value4');

var unmform_values=rad_obj.value.split(',');

PriceA.value=unmform_values[0];
PriceB.value=unmform_values[1];
PriceC.value=unmform_values[2];
date.value=unmform_values[3];
}


</SCRIPT>


<TABLE width=570>
<TBODY>
<TR>
<TD style="BACKGROUND-COLOR: rgb(192,0,0)" class=style2 vAlign=top align=middle><FONT color=#ffffff><STRONG>Broadway Series <INPUT type=hidden name=unmform_LineBreak_Broadway_Select1> <INPUT type=hidden name=unmform_LineBreak_Broadway_Select2> </STRONG></FONT></TD>
<TD vAlign=top align=middle><FONT style="FONT-SIZE: 14px"><STRONG>Please Select a Series:</STRONG></FONT></TD>
<TD vAlign=center align=middle><SELECT name=unmform_Series> <OPTION selected value=No_Broadway_Selected>No Selection</OPTION> <OPTION onclick=set_pricetag(this); value=164.75,134.75,99.75,---Series1_Fri8--- name="unmform_Series1_Fri8">Series 1: Friday @ 8PM</OPTION> <OPTION onclick=set_pricetag(this); value=167.25,137.25,102.25,---Series2_Sat2--- name="unmform_Series2_Sat2">Series 2: Saturday @ 2PM</OPTION> <OPTION onclick=set_pricetag(this); value=164.75,134.75,99.75,---Series3_Sat8--- name="unmform_Series3_Sat8">Series 3: Saturday @ 8PM</OPTION> <OPTION onclick=set_pricetag(this); value=167.25,137.25,102.25,---Series4_Sun2--- name="unmform_Series4_Sun2">Series 4: Sunday @ 2PM - Mary Poppins&amp;Lion King @ 1:30</OPTION> <OPTION onclick=set_pricetag(this); value=164.75,134.75,99.75,---Series5_Sun8--- name="unmform_Series5_Sun8">Series 5: Sunday @ 8PM - Mary Poppins&amp;Lion King @ 6:30</OPTION></SELECT> </TD></TD></TR></TBODY></TABLE>
<TABLE class=SMALL border=0 width=570 tixs_requestedpadding="0" tixs_requestedspacing="0">
<TBODY>
<TR>
<TD style="WIDTH: 55px" vAlign=top align=middle><INPUT border=0 value="Price A" readOnly align=middle size=10 name=Broadway_PriceA> </TD>
<TD style="WIDTH: 95px" vAlign=top align=middle><INPUT onkeyup="this.form.unmform_Total_Broadway_PriceA.value = (this.form.unmform_Tix_Requested_broadway_PriceA.value * this.form.unmform_Series_PriceA.value) -0;calculate(this.form)" name=unmform_Tix_Requested_broadway_PriceA autocomplete="off"></TD>
<TD style="WIDTH: 95px" vAlign=top align=middle><INPUT id=value1 readOnly name=unmform_Series_PriceA></TD>
<TD style="WIDTH: 94px" vAlign=top align=middle><INPUT border=0 value=0 readOnly size=10 name=unmform_Total_Broadway_PriceA><INPUT type=hidden name=unmform_LineBreak1> </TD></TR>
<TR>
<TD style="WIDTH: 55px" vAlign=top align=middle><INPUT border=0 value="Price B" readOnly align=middle size=10 name=Broadway_PriceB> </TD>
<TD style="WIDTH: 95px" vAlign=top align=middle><INPUT onkeyup="this.form.unmform_Total_Broadway_PriceB.value = (this.form.unmform_Tix_Requested_broadway_PriceB.value * this.form.unmform_Series_PriceB.value) -0;calculate(this.form)" name=unmform_Tix_Requested_broadway_PriceB autocomplete="off"></TD>
<TD style="WIDTH: 95px" vAlign=top align=middle><INPUT id=value2 readOnly name=unmform_Series_PriceB></TD>
<TD style="WIDTH: 94px" vAlign=top align=middle><INPUT border=0 value=0 readOnly size=10 name=unmform_Total_Broadway_PriceB><INPUT type=hidden name=unmform_LineBreak2> </TD></TR>
<TR>
<TD style="WIDTH: 55px" vAlign=top align=middle><INPUT border=0 value="Price C" readOnly align=middle size=10 name=Broadway_PriceC> </TD>
<TD style="WIDTH: 95px" vAlign=top align=middle><INPUT onkeyup="this.form.unmform_Total_Broadway_PriceC.value = (this.form.unmform_Tix_Requested_broadway_PriceC.value * this.form.unmform_Series_PriceC.value) -0;calculate(this.form)" name=unmform_Tix_Requested_broadway_PriceC autocomplete="off"></TD>
<TD style="WIDTH: 95px" vAlign=top align=middle><INPUT id=value3 readOnly name=unmform_Series_PriceC></TD>
<TD style="WIDTH: 94px" vAlign=top align=middle><INPUT border=0 value=0 readOnly size=10 name=unmform_Total_Broadway_PriceC><INPUT type=hidden name=unmform_LineBreak3> </TD></TR></TBODY></TABLE><BR>
 
IE doesn't react to events in <option> tags. You need to set the onclick directly on the <select> tag instead.

Code:
<select onclick="set_pricetag(this);">

Next time wrap your code in [ignore]
Code:
[/ignore] tags, hopefully that will make it easier to read.



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Thank you, That is exactly what i needed. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top