Current location: Hot Scripts Forums » General Web Coding » JavaScript » I want to make table row flahses


I want to make table row flahses

Reply
  #1 (permalink)  
Old 02-02-05, 06:05 AM
GS300 GS300 is offline
Newbie Coder
 
Join Date: May 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
I want to make table row flahses

Hi all ,

I want to make table row flahses

How can I do taht ? ?

Thanks in advance
Reply With Quote
  #2 (permalink)  
Old 02-02-05, 11:18 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
You can change the background-color style attribute between two colors with an interval.
Ex.
Code:
<html>
<head>
<script>

function Flash(obj,color1,color2,ontime,offtime){
	var row = document.getElementById(obj)
	row.style.backgroundColor=color1
	setTimeout("flashOff('"+obj+"','"+color1+"','"+color2+"','"+ontime+"','"+offtime+"')",ontime)
}

function flashOff(obj,color1,color2,ontime,offtime){
	var row = document.getElementById(obj)
	row.style.backgroundColor=color2
	setTimeout("Flash('"+obj+"','"+color1+"','"+color2+"','"+ontime+"','"+offtime+"')",offtime)
}
</script>
</head>
<body bgcolor="green" onload="Flash('rowToFlash','red','',200,600)">
<table>
<tr id='rowToFlash'>
<td>
Test
</td>
<td>
Test 2
</td>
</tr>
<tr>
<td>
Test 3
</td>
<td>
Test 4
</td>
</tr>
</table>
</body>
</html>
This should work on any object with the style.backgroundColor property.
Reply With Quote
  #3 (permalink)  
Old 02-03-05, 02:28 PM
GS300 GS300 is offline
Newbie Coder
 
Join Date: May 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks TwoD

Your code working fine But I made some modification in your code
for simplicity I deleted FlashOff function and use only one function with the period instead of inTime , OffTime .

And this is the code :

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script>

function Flash(obj,color1,color2,period){
	var row = document.getElementById(obj)
	row.style.backgroundColor=color1
	setTimeout("Flash('"+obj+"','"+color2+"','"+color1+"','"+period+"')",period)
}

</script>
</head>
<body bgcolor="green" onload="Flash('rowToFlash','red','green',1000)">
<table>
<tr id='rowToFlash'>
<td>
Test
</td>
<td>
Test 2
</td>
</tr>
<tr>
<td>
Test 3
</td>
<td>
Test 4
</td>
</tr>
</table>
</body>
</html>
Thanks again
Reply With Quote
  #4 (permalink)  
Old 02-04-05, 04:53 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
Your welcome!
It's good when people adapt code to their own uses since you almost always learn somehting from it.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with a sort table js function tdubyou JavaScript 0 05-03-04 09:19 AM
auto table resize derick_2k JavaScript 4 04-26-04 02:32 PM


All times are GMT -5. The time now is 10:41 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.