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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Firefox compatibility for onchange event

Status
Not open for further replies.

futurevc

Programmer
Sep 21, 2005
3
GB
Hi

Some simple code written for IE, doesnt work in the increasingly popular browser. Sure its easily fixed...

This is actually coldfusion code but its a javascript thing - define my function goto(form) called by "onchange=goto(this.form)"

tried changing function to something simpler. Nothing happens, works fine in IE

Any suggestions??

Cheers

Tim
<SCRIPT language=JavaScript>

<!--
function goto(form) { var index=form.select.selectedIndex
if (form.select.options[index].value != "0") {
location=form.select.options[index].value;}}
//-->
</SCRIPT>


<table cellpadding=0 cellspacing=0>
<FORM name=form1>
<TR>
<TD vAlign=top align=left colspan="3">
<br>
<SELECT
style="FONT-SIZE: 8pt; BACKGROUND: #000066; WIDTH: 250px; COLOR: white; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif"
onchange=goto(this.form) align=left size=1 name=select>
<OPTION style="BACKGROUND: #000066; COLOR: #FFFFFF" value=""
selected>Current reports</OPTION>
<!--- first was BACKGROUND: #99ccFF; COLOR: #000066 --->
<cfoutput><cfloop from="1" to="#showreports.recordcount#" index="i">
<OPTION
value=#linknames#>#arraynames#</OPTION>
</cfloop> </cfoutput>
</SELECT></TD></TR>
</FORM>

</table>
 
>[tt]onchange=goto(this.form)[/tt]
goto reserved word. Change it to something other name.

The rest leaves something to desire such as enclosing the handler by quotes etc. But, it should still function cross browser.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top