Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Highlight Tables On Mouseover, Example Script
deedee2003
post Sep 5 2004, 08:58 PM
Post #1


Newbie [Level 1]
*

Group: Members
Posts: 10
Joined: 5-September 04
Member No.: 1,025



Heare is a good trick:
Copy and paste the code below, into the <head> of your html document:
CODE
<script>
function changeto(highlightcolor){
source=event.srcElement
if (source.tagName=="TR"||source.tagName=="TABLE")
return
while(source.tagName!="TD")
source=source.parentElement
if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
source.style.backgroundColor=highlightcolor
}

function changeback(originalcolor){
if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")
return
if (event.toElement!=source)
source.style.backgroundColor=originalcolor
}
</script>

Now in the table write:
CODE
<table onMouseover="changeto('lightgreen')" onMouseout="changeback('white')">

of course you can put anny color.

To exclude any cell(s) from the rollover effect, simply give that cell an id="ignore"
CODE
<table onMouseover=.... onMouseout=....>
<td id="ignore">

and that`s it , if you have any questions ask me wink.gif
Go to the top of the page
 
+Quote Post
Triple X
post Sep 5 2004, 09:27 PM
Post #2


Super Member
*********

Group: Members
Posts: 390
Joined: 22-August 04
From: No Where
Member No.: 876



QUOTE(deedee2003 @ Sep 5 2004, 03:58 PM)
Heare is a good trick:
Copy and paste the code below, into the <head> of your html document:
CODE
<script>
function changeto(highlightcolor){
source=event.srcElement
if (source.tagName=="TR"||source.tagName=="TABLE")
return
while(source.tagName!="TD")
source=source.parentElement
if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
source.style.backgroundColor=highlightcolor
}

function changeback(originalcolor){
if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")
return
if (event.toElement!=source)
source.style.backgroundColor=originalcolor
}
</script>

Now in the table write:
CODE
<table onMouseover="changeto('lightgreen')" onMouseout="changeback('white')">

of course you can put anny color.

To exclude any cell(s) from the rollover effect, simply give that cell an id="ignore"
CODE
<table onMouseover=.... onMouseout=....>
<td id="ignore">

and that`s it , if you have any questions ask me  wink.gif

*already knew*

Its pretty neat...did I just use the word neat...*shoots himself*.

On a side note: you have the smallest IP I have ever seen o_o
Go to the top of the page
 
+Quote Post
Zenchi
post Sep 5 2004, 10:20 PM
Post #3


Super Member
*********

Group: Members
Posts: 498
Joined: 23-August 04
Member No.: 878



Aye, that's awesome! Is there any way to make it dither or change colors like from white to gray smoothly? biggrin.gif
Go to the top of the page
 
+Quote Post
NeXDesigns
post Sep 12 2004, 07:35 PM
Post #4


Super Member
*********

Group: Members
Posts: 260
Joined: 12-August 04
From: Hurricane Alley, Florida
Member No.: 770



yeah like make it fade from the two colors? or only possible in flash?
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Could Someone Make A Php Script For Me?(3)
  2. Php Quiz Script(20)
  3. Many Php Script Sites(16)
  4. Free Weather Feed Script(1)
  5. [help] Java Script: Window.open(10)
  6. Web Surfing- Script Needed(2)
  7. Delay X Seconds In Flash(1)
  8. Verifying Email Addresses(9)
  9. Watermark Your Image With Simple Php Script(35)
  10. Jsp Or Java Chat Script Like Mig33(5)
  11. Very Simple Online Now Script(4)
  12. Html Code Tester. Online Script(15)
  13. Background Image Swap Script(15)
  14. Invite Script..(2)
  15. Loaing Script(3)
  1. Php Downloads Script(4)
  2. Need Help Installing Dolphin Community Script!(5)
  3. Login Script For Vbulletin.(9)
  4. Guessing Php Script(2)
  5. How To Make A View New Post Script?(5)
  6. Phpizabi Social Network Script(1)
  7. Php Guest Online Script(3)
  8. How To Make Php Newsletter Script(3)
  9. Browser Compatibility Problem With Firefox - Javascript + Css(3)
  10. Seeking Help With Javascript(1)
  11. [request] Avatar For Trap17 Users(0)
  12. Java Script To Hide The Url In Address Bar(6)
  13. Need Help With Javascript Drag And Drop Script(2)


 



- Lo-Fi Version Time is now: 8th October 2008 - 05:39 AM