/    Sign up×
Community /Pin to ProfileBookmark

Javascript error in firefox

The code below works well in IE, it even works in firefox. But when I put this same JS on my actual page it will not work. I want to fix the errors and see if that helps. Here is the code:

<html> <head> <title></title>
<script language=”JavaScript” type=”text/javascript”>
function DoSilk(x){
if (1<=x && x<=20) y=(0.0524*x*x)-(2.1391*x)+(32.04575);
if (20<x && x<=50) y=39.779 *
Math.pow(x, -0.4532);
if (50<x && x<=288) y=(10.4835 * Math.pow(x, -0.121635))+.2;
if (288<x && x<=4200) y=(10.4835 *
Math.pow(x, -0.121635))+.2;
if (4200<x) y=4;
}
function DoHeat(x){
if (1<=x && x<=100) y=(10.87*Math.pow(x,-.17))+1.03;
if (100<x) y=6;
}
function Radio(obj){
y=’?’;
x=document.forms.formjunk.product_options_amountzz.value;
rbs=obj.getElementsByTagName(‘INPUT’);
if (rbs[0].checked){
DoSilk(x);
}
if (rbs[1].checked){
DoHeat(x);
}
if (rbs[2].checked){
y=4;
}
document.getElementById(‘price’).value=y;
document.forms.orderform_16180.subtotal.value = (document.forms.orderform_16180.price.value*
document.forms.formjunk.product_options_amountzz.value);
}
</script>
</head> <body>
<P>Quantity</P>
<FORM name=”formjunk” method=”post” action=””>
<INPUT type=”text” name=”product_options_amountzz” onBlur=”Radio(radioFred)”>
</form>
<P>

<FORM name=”form15″ method=”post” action=””>
<span id=”radioFred” onclick=”Radio(this);” >
Silk Screen<input type=”radio” name=”radioFred”> <br>
Heat Transfer<input type=”radio” name=”radioFred”><br>
Blank<input type=”radio” name=”radioFred”> <br>
</span>
</form>
<FORM name=”orderform_16180″ method=”post” action=””>
Price Per<input id=”price” size=”10″> <br>subtotal<input id=”subtotal” size=”10″>
</FORM>
</body>
</html>

I get the following errors: radioFred is not defined. document.getElementById(“price”) has no properties. I’m not sure if this is part of the problem on my actual page, but I can’t think of anything else. I’ve been reading on the web about these problems being created by local/global issues. What do I have to do to get rid of these errors?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@FangMay 22.2005 — Read your previous [URL=http://www.webdeveloper.com/forum/showthread.php?t=66824]post[/URL]
Copy linkTweet thisAlerts:
@LocalHeroauthorMay 22.2005 — Oops! Two people working on the same site. I didn't know we'd already asked. Thanks.
×

Success!

Help @LocalHero 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.5,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...