Results 1 to 3 of 3

Thread: Flashing Table Border: Need Variation

  1. #1
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Flashing Table Border: Need Variation

    Flashing Table Border Script
    http://www.dynamicdrive.com/dynamicindex11/other2.htm

    I've pasted the DD script below.

    The script and DD example page are set up to flash the border of ONE table. I have 4 seperate tables located at different places on my webpage. I have pasted the script 4 seperate times then changed the function and ID of each script- and its corresponding table- to flash the borders on the 4 tables. All of the borders are doing the exact same thing with the exact colors- which is what I want.

    Can I use the script just ONCE- with modifications- that allow it to do the exact same thing on the 4 tables- rather than using the entire script 4 times? If so- be gentle- I'll need to see the fixed code.

    ////////////////////
    Flashing Table Border Script
    http://www.dynamicdrive.com/dynamicindex11/other2.htm

    <table border="0" width="280" id="myexample" style="border:5px solid green">
    <tr>
    <td>Insert anything you want into this table.<br>Insert anything you want into this table.<br>Insert anything you want into this table.<br></td>
    </tr>
    </table>
    <script language="JavaScript1.2">
    <!--

    /*
    Flashing Table Border Script- © Dynamic Drive (www.dynamicdrive.com)
    Visit http://www.dynamicdrive.com for this script
    Credit must stay intact for use
    */

    //configure interval btw flash (1000=1 second)
    var speed=500

    function fla****(){
    var crosstable=document.getElementById? document.getElementById("myexample") : document.all? document.all.myexample : ""
    if (crosstable){
    if (crosstable.style.borderColor.indexOf("green")!=-1)
    crosstable.style.borderColor="red"
    else
    crosstable.style.borderColor="green"
    }
    }
    setInterval("fla****()", speed)
    //-->
    </script>
    //////////////////////////

    Thanks,
    Bill

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    <script type="text/javascript">
    
    /*
    Flashing Table Border Script- &#169; Dynamic Drive (www.dynamicdrive.com)
    Visit http://www.dynamicdrive.com for this script
    Credit must stay intact for use
    */
    
    //configure interval between flashes in milliseconds (1000=1 second)
    var speed = 500;
    
    var getTable = (function() {
      var w3c = function(id) {
        return document.getElementById(id);
      }
      var ie = function(id) {
        return document.all[id];
      }
      var none = function(id) {
        return false;
      }
      return (document.getElementById ? w3c : (document.all ? ie : none));
    })();
    
    function fla****() {
      var crosstable = false;
      for(var i=1;crosstable = getTable("flashtable" + i);i++) {
        if (crosstable.style.borderColor.indexOf("green")!=-1)
          crosstable.style.borderColor="red";
        else
          crosstable.style.borderColor="green";
      }
    }
    setInterval("fla****()", speed);
    </script>
    Untested. Give your tables incremental IDs, such as, in this example: flashtable1, flashtable2, flashtable3, flashtable4...
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Works like a charm

    Works like a charm.

    What can I say?... Yer Da Man!!!!!

    Thanks a million,
    Bill

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
  •