Results 1 to 5 of 5

Thread: highlight table row[resolved]

Threaded View

  1. #1

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    highlight table row[resolved]

    Ok, so I have the following Javascript functions which I use to change the background color of TD elements. Now I want to highlight an entire row when the mouse is over any TD element of that row. I've copied the changeto function and played with it and called it "changeto2", but what I'm doing doesn't seem to work. Help?

    Code:
    	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 changeto2(highlightcolor){
    	source=event.srcElement
    	if (source.tagName=="TABLE"||source.tagName=="TD")
    	return
    	while(source.tagName!="TR")
    	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
    	}
    Last edited by ober0330; Jun 4th, 2004 at 11:52 AM.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width