Jump to content
xisto Community
Sign in to follow this  
deedee2003

Highlight Tables On Mouseover Example Script

Recommended Posts

Heare is a good trick:
Copy and paste the code below, into the <head> of your html document:

<script>[br]function changeto(highlightcolor){[/br]source=event.srcElement[br]if (source.tagName=="TR"||source.tagName=="TABLE")[/br]return[br]while(source.tagName!="TD")[/br]source=source.parentElement[br]if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")[/br]source.style.backgroundColor=highlightcolor[br]}[/br][br]function changeback(originalcolor){[/br]if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")[br]return[/br]if (event.toElement!=source)[br]source.style.backgroundColor=originalcolor[br]}[/br]</script>
[/br]Now in the table write:
<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"

<table onMouseover=.... onMouseout=....>[/br]<td id="ignore">
and that`s it , if you have any questions ask me :P

Share this post


Link to post
Share on other sites

Heare is a good trick:Copy and paste the code below, into the <head> of your html document:

<script>[br]function changeto(highlightcolor){[/br]source=event.srcElement[br]if (source.tagName=="TR"||source.tagName=="TABLE")[/br]return[br]while(source.tagName!="TD")[/br]source=source.parentElement[br]if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")[/br]source.style.backgroundColor=highlightcolor[br]}[/br][br]function changeback(originalcolor){[/br]if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")[br]return[/br]if (event.toElement!=source)[br]source.style.backgroundColor=originalcolor[br]}[/br]</script>
[/br]Now in the table write:
<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"
<table onMouseover=.... onMouseout=....>[/br]<td id="ignore">

and that`s it , if you have any questions ask meĀ  :P

*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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.