Results 1 to 3 of 3

Thread: Flashing Table Border Script - flash 6 borders on one page.

  1. #1
    Join Date
    Jan 2006
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Flashing Table Border Script - flash 6 borders on one page.

    1) Script Title: Flashing Table Border Script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex11/other2.htm

    3) Describe problem: Very simple question, I want to flash the border of 6 tables on one html page. All 6 are the same text and same colours. I did try and do this myself, I changed the id="myexample" in each repition of the code on my page but no luck.
    Once I repeat the code again on the page the flashing stops.

    I dare say its something simple to sort out but I'm stuck.

    The text in a box is the same each time, so I guess there would be a simpler way to repeat the flashing box rather than using the same code over and over.

    Best wishes

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Give this demo a shot. Let me know if you have questions:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>Flashing Tables</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="shortcut icon" href="file://localhost/C:/webwork2/favicon.ico">
    <style type="text/css">
    /*Set initial style for table border(s) here (the off state)*/
    #flashtable0, #flashtable1 {
    border:5px solid green;
    }
    #ftable2s0, #ftable2s1 {
    border:3px solid black;
    }
    </style>
    <script type="text/javascript">
    
    /***********************************************
    * Flashing Table Script - © very freely adapted from
    * Flashing Link Script- © Dynamic Drive (www.dynamicdrive.com)
    * By jscheuer1 in http://www.dynamicdrive.com/forums
    * This notice must stay intact for legal use
    * Visit http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    function flashtables(id_base, flash_color, random, staggered){
    if(!document.getElementById&&!document.all){return;};
    var cacheobj=this;
    var changebordercolor=function(el){
    var el=el; el.style.borderColor=el.on=!el.on? flash_color : '';
    setTimeout(function(){changebordercolor(el);},1000+(!random?0:Math.floor(Math.random()*234)))
    }
    var startchangeborder=function(el){
    var el=el; setTimeout(function(){changebordercolor(el);},383+(!staggered?0:(cacheobj.it+=234)))
    }
    var init=function(){
    var i=0; this.it=0; while(document.all&&document.all[id_base+i]!=null)
    startchangeborder(document.all[id_base+i++]);
    while (!document.all&&document.getElementById(id_base+i)!=null)
    startchangeborder(document.getElementById(id_base+i++));
    }; init(); };
    
    </script>
    </head>
    <body>
    <div>
    <table id="flashtable0">
    <tr>
    <td>Table 0</td>
    </tr>
    </table><br>
    <table id="flashtable1">
    <tr>
    <td>Table 2</td>
    </tr>
    </table><br>
    <table id="ftable2s0">
    <tr>
    <td>Table 2.0</td>
    </tr>
    </table><br>
    <table id="ftable2s1">
    <tr>
    <td>Table 2.1</td>
    </tr>
    </table><br>
    
    </div>
    <script type="text/javascript">
    //usage new flashtables('id_base', 'flash_color(the on state)', random(1=yes - 0=no), staggered(1=yes - 0=no))
    new flashtables('flashtable', 'red', 1, 1)
    new flashtables('ftable2s', 'yellow', 0, 0)
    </script>
    </body>
    </html>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Feb 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hi,
    This script work in the div tag , but dont work in the table. Help please.Thank you.

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
  •