Highlight Tables On Mouseover - Example Script

free web hosting
Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > HTML, XML etc..

Highlight Tables On Mouseover - Example Script

deedee2003
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

 

 

 


Reply

Triple X
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

 

 

 


Reply

Zenchi
Aye, that's awesome! Is there any way to make it dither or change colors like from white to gray smoothly? biggrin.gif

Reply

NeXDesigns
yeah like make it fade from the two colors? or only possible in flash?

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : highlight tables mouseover script

  1. Can You Put Tables Inside Of Tables? - (6)
  2. Help With Tables Please - :) (4)
    Ok need a little help I own a site called Gaming-Alliance www.gaming-alliance.net anywho i have
    this issue with tables i have it set so that it'll make links in a row under my head thing heres
    the link to that so far, i cannot continue without this help /smile.gif"
    style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> so please make it fast
    /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> heres the
    code Gaming Alliance - Next Generation Of Gamers Today
    heres th...
  3. In Need For A Rotating Ad Banner Script - (5)
    Im looking for a rotaing ad banner script. any omne here have one.. that will work with just simple
    html coding. ...
  4. Advanced Html Frame Tag - Frames and Tables (3)
    FRAME SYNTAX Frame syntax is similar in scope and complexity to that used by tables, and has been
    designed to be quickly processed by Internet client layout engines. CODE <FRAMESET>
    This is the main container for a Frame. It has 2 attributes ROWS and COLS. A frame document has
    no BODY, and no tags that would normally be placed in the BODY can appear before the FRAMESET tag,
    or the FRAMESET will be ignored. The FRAMESET tag has a matching end tag, and within the FRAMESET
    you can only have other nested FRAMESET tags, FRAME tags, or the NOFRAMES tag. ...
  5. Firefox Script Problem - (5)
    Why Firefox can't scripting on below script:- CODE <center><a
    href='http://www.yahoo.com'>Yahoo!</a></center> If correct,
    the webpage should run "Yahoo!" at the center. When I using Internet Explorer, it run
    correctly, but when I using Firefox, the "Yahoo!" will go to the left side. Who know this,
    please explain to me and show me the introdution to make "Yahoo!" to center by using Firefox and
    Internet Explorer browser....
  6. Anti-hotlink Script ..... - (4)
    Does anyone know if/where I can get a free script for tracking direct/hot linkers? ..... so I can
    leave a "theft" graphic in place of the image they've hot linked .... ...
  7. Looping Script - (1)
    I'm making a script for making images animate while a link is "OnMouseOver". I've made 20
    images for the anim. The reason for not just making an gifanim and replacing the still
    image(original image) is that when the mouse leaves the link it should stop in the middle of tha
    anim and begin from the place it sstopped at the next time the link is "OnMouseOver" ...
  8. Tables Invading Space - (3)
    hi all ! I have 3 tables in my JSP, now the prob is that when I get some result from my server
    the tables seems to invade the other table's space, for example table number 2 goes up and gets
    to the right of table 1. (see atachments). Here is the code, all 3 tables has the same code except
    the variables. Code: CODE <table border="1" align="left"
    cellpadding="10" cellspacing="5" id="normales">        <tr>  
           <td class="style13"><div align="center" class="style22&#...
  9. Form Highlight? - (5)
    I have a code on my webpage: "link to us", and a text area where the code is... Anyway, when the
    user click in the text area, is there a code to highlight the content? Something like ?...
  10. Question About Tables! - (13)
    How can I make tables on my web page to be static (always same size)? I want my page to always be
    the same size, I don't want my text to adjust to visible on the page when you make window
    smaller. I want horizontal scroll bar to appear!!! Help me!!!!...
  11. Html, Css, Tables... - 3 column, header, and possibly footer (10)
    Which one should I use to design my site with? Or mostly use anyway. Which is better for making it 3
    column, header and maybe footer? Where can I find a ready made code? /tongue.gif' border='0'
    style='vertical-align:middle' alt='tongue.gif' /> ...
  12. Optimize Html Tables For Search Engines - how to tutorial (0)
    Perhaps you've heard that HTML tables reduce search engine optimization efficiency. The truth
    is, it isn't the HTML table layout that reduces the efficiency, it's the content order of
    appearance within the table that auses the search engine problems. Specifically, it's when
    site navigation is placed inside the first cell of the table that causes search engines to
    erroneously catalog the navigation links as the theme of your site. Simply put, site navigation
    utilizes words like Home, Products, Services, Contacts Us, About Us, Privacy Policy, etc. Such ...
  13. Bg Of Tables - (1)
    is it possible to make a smaller background for a cell in a table because it would make it easier to
    make better looking sites and are there any other way to make good looking drop down link instead of
    using the inbuilt simple technique of: Element 1 Element 2 ...



Looking for highlight, tables, mouseover, script

Searching Video's for highlight, tables, mouseover, script
advertisement



Highlight Tables On Mouseover - Example Script



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE