...

View Full Version : any idea why this works in IE but not mozilla firefox?



PaulnOZ
10-12-2004, 11:59 PM
<SCRIPT LANGUAGE="Javascript1.1" type="text/javascript">
var sun = -48+(-1*(48*(Math.sin(202 * Math.PI/180))));
var possy = "0 " + sun;
document.getElementById('banana').style.backgroundPosition = possy;
</SCRIPT>

I have this in the <BODY> of the page and it works fine in IE but in Firefox the background possy doesn't get changed. It's probably something simple that I've missed. Any help would be great.

Paul

liorean
10-13-2004, 12:12 AM
Try adding a unit, all lenghts must have one in CSS.

PaulnOZ
10-14-2004, 11:34 PM
Sweet, thanks liorean, I changed the above code to...

<SCRIPT LANGUAGE="Javascript1.1" type="text/javascript">
var sun = -48+(-1*(48*(Math.sin(202 * Math.PI/180))));
var possy = "0px " + sun +"px";
document.getElementById('banana').style.backgroundPosition = possy;
</SCRIPT>
...and now it works great.

I guess the <a href="http://www.w3.org/TR/html4/loose.dtd">Loose Translation</a> isn't as loose as I thought ;-)

Thanks again mate,

Paul

lavalamp
10-16-2004, 04:03 PM
That DTD applies to HTML, not CSS. With CSS there are only two flavours, standard and crappy-IE. :p



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum