SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot Mr. Ram's Avatar
    Join Date
    Nov 2005
    Posts
    139
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Question setInterval( ) problem in Firefox

    The following line is not working in Firefox, but fine in IE

    <BODY bottomMargin=0 leftMargin=0 rightMargin=0 topMargin=0 bgColor="#FFFFFF" onload="setInterval('cycleColors()', 100);" >

  2. #2
    SitePoint Zealot Mr. Ram's Avatar
    Join Date
    Nov 2005
    Posts
    139
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Sorry......... I am facing problem with this function.
    I think...... document.all is not compatible with FF

    function cycleColors()
    {
    if (bAscending)
    {
    with(document.all)
    celColorChange[iCurrentCELL].style.color=sColor2;

    iCurrentCELL++;

    if (iCurrentCELL>14)
    {
    bAscending=false;
    iCurrentCELL=14;
    }
    }
    else
    {
    with(document.all)
    celColorChange[iCurrentCELL].style.color=sColor1;

    iCurrentCELL--;
    if (iCurrentCELL==0)
    {
    bAscending=true;
    changeColors();
    }
    }
    }

  3. #3
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Some tips about your code. Use CSS instead of settings all those properites on the body tag.

    example
    Code:
    body
    {
        padding:0;
        margin:0;
        background-color:#fff;
    }
    When it comes to your JavaScript code, using with is evil. It will affect the performance.

    And about document.all, read this post

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,834
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    document.all was for IE4. For more recent browsers you should be using document.getElementById()
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

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