/    Sign up×
Community /Pin to ProfileBookmark

Multiple script call from onClick event. Firefox probs.

First off, hi all, this is my first post… I’m a bit of a noob to this, so please bear with me.

I’m using a script (with inner HTML), to swap currencies. My onClick event calls two scripts to change the content of two cells. It works fine in IE, but Firefox… Nothing. I’ve run firebug, the error returned is “illegal character”. This is basically chinese to me. I’ve copied the code below. Any help or guidance on this matter is very much apreciated. Best regards. Mark

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@APECBLOKEauthorJun 16.2010 — <html>

<head>

<script type="text/javascript">

function changeContent1&#8364;(){

var x=document.getElementById('myTable').rows

var y=x[1].cells

y[1].innerHTML="1&#8364;"

}

function changeContent2&#8364;(){

var x=document.getElementById('myTable').rows

var y=x[2].cells

y[1].innerHTML="2&#8364;"

}

function changeContent1&#163;(){

var x=document.getElementById('myTable').rows

var y=x[1].cells

y[1].innerHTML="1&#163;"

}

function changeContent2&#163;(){

var x=document.getElementById('myTable').rows

var y=x[2].cells

y[1].innerHTML="2&#163;"

}

function changeContent1$(){

var x=document.getElementById('myTable').rows

var y=x[1].cells

y[1].innerHTML="1$"

}

function changeContent2$(){

var x=document.getElementById('myTable').rows

var y=x[2].cells

y[1].innerHTML="2$"

}

function changeContentRevert1(){

var x=document.getElementById('myTable').rows

var y=x[1].cells

y[1].innerHTML="$22,564m(AD)"

}

function changeContentRevert2(){

var x=document.getElementById('myTable').rows

var y=x[2].cells

y[1].innerHTML="$44,895(AD)"

}

</script>

<style type="text/css">

<!--

.style1 { font-family: Arial, Helvetica, sans-serif;

font-size: 12px;

}

.style2 {color: #FFFFFF}

body {

margin-left: 0px;

margin-top: 20px;

}

-->

</style>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>

<body>

<table width="253" height="199" border="0" bgcolor="#FFFFFF" id="myTable">

<tr>

<td width="158" height="21" class="style1">Population</td>

<td width="85" height="21" bgcolor="#CCCCCC" class="style1">502,600</td>

</tr>

<tr>

<td height="21" class="style1">Gross State Product (GSP) </span></td>

<td height="21" bgcolor="#CCCCCC" class="style1">$22,564m(AD) </td>

</tr>

<tr>

<td height="21" class="style1">GSP Per Capita (PPP) </td>

<td height="21" bgcolor="#CCCCCC" class="style1">$44,895(AD) </td>

</tr>

<tr>

<td colspan="2" valign="bottom"><form>

<div align="right"><span class="style1">Change to </span>

<input name="button2" type="button" onClick="changeContent1&euro;(); changeContent2&euro;();" value="&euro;" />

<input name="button" type="button" onClick="changeContent1&pound;(); changeContent2&pound;();" value="&pound;" />

<input name="button3" type="button" onClick="changeContent1$(); changeContent2$();" value="$" />

<input name="button32" type="button" onClick="changeContentRevert1(); changeContentRevert2();" value="Revert" />

</div>

</form>

<iframe id="NewsWindow" src="canberraquickfacts.html" width="247" height="90" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" style="border: #000000 0px solid;"></iframe></td>

</tr>

</table>

</body>

</html>
Copy linkTweet thisAlerts:
@FangJun 16.2010 — The function names are invalid. The function name can contain only alphanumeric characters (alphabetic and digits) and the underscore and cannot begin with a number.// bad
changeContent1[COLOR="Red"]&amp;#8364;[/COLOR]
// good
changeContent1Euro
×

Success!

Help @APECBLOKE spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...