Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Oct 2004
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    any idea why this works in IE but not mozilla firefox?

    <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

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Try adding a unit, all lenghts must have one in CSS.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    New to the CF scene
    Join Date
    Oct 2004
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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
    Last edited by PaulnOZ; 10-15-2004 at 12:37 AM.

  • #4
    Regular Coder
    Join Date
    Aug 2003
    Location
    Loughborough University
    Posts
    427
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That DTD applies to HTML, not CSS. With CSS there are only two flavours, standard and crappy-IE.
    AMD Athlon "Barton" XP 3200+ (11*200.5MHz = 2.2GHz)
    BFG GeForce 6800 Ultra OC 256Mb
    3 * Kingston 256Mb PC3200 DDR400
    Seagate Barracuda 120Gb Ultra ATA-100 and Seagate Barracuda 160Gb, SATA-150


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •