www.webdeveloper.com
Results 1 to 2 of 2

Thread: flashing tbale border in FileFox

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Posts
    73

    resolved flashing tbale border in FileFox

    Hi.
    I tried to get a flashing table bordr, it worked OK in IE 6 but NOT if FF.
    I found the the problem is:
    FF can WRITE getElementById but it CAN NOT READ IT
    so I found an "Elegant" way to bypass it by creating a dummy color variable: col
    the table is:
    <table border="0" id="table" style="border: 4px blue solid;">
    .....
    </table>

    <script language="javascript">
    var col = 'blue'
    function flasher() {
    if(col == 'blue') {
    document.getElementById('table').style.borderColor = 'red'
    col = 'red'
    } else {
    document.getElementById('table').style.borderColor = 'blue'
    col = 'blue'
    }
    setTimeout("flasher()" , 1000)
    }
    </script>
    <script language="javascript">flasher();</script>

    It works in both IE6 and FF 3.
    see a demo: www.the-secret-of-SEO.com


  2. #2
    Join Date
    May 2009
    Posts
    150
    Firstly, that's got nothing to do with FF's use of getElementById, it's because first time FF calls that function the style is not stored on the element, it's in a style attribute, which for some reason it treats differently. Where you have:

    [code]col = blue;[/col]

    Do:

    Code:
    document.getElementById('table').style.borderColor = 'blue'
    Then your original IE code should work on FF too. Or, better yet, do:

    Code:
    var elStyle = document.getElementById('table').style;
    elStyle.borderColor = 'blue';
    Saves a lot of time in subsequent uses if you use that variable instead.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles