PDA

View Full Version : Flashing Table Border Script - flash 6 borders on one page.



absolutely
05-02-2007, 11:40 AM
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

jscheuer1
05-03-2007, 04:57 AM
Give this demo a shot. Let me know if you have questions:


<!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>

mindvortex
02-22-2011, 01:19 AM
hi,
This script work in the div tag , but dont work in the table. Help please.Thank you.