Ronx - Help needed again on Behavior question

R

Richard

Last year I got help on a behavior question I had. Unfortunately that
computer died and I can't seem to locate the response, so here goes again. I
have a hiking website with a page showing distances between numerous points
in the Grand Canyon. The page is basically twenty or so columns and rows.
To make it easier on the viewer to ascertain exactly which row the cursor is
on, I have made the row heading background color change. When I made the
interior cell the cursor is on also change background colors, Front Page's
"Change Prop Restore" command only changes back one of the background colors,
leaving one cell highlighted when it shouldn't be. i.e. the onmouseout
doesn't work on the second color. I am attempting to achieve what an Excel
spreadsheet does by highlighting both the cell the cursor is on and the row
heading. The link where my distance chart can be found is:

http://www.allhikers.com/allhikers/...s-Campsites/Detailed-trail-distances-east.htm

Ron had previously provided some CSS that accomplished this. Thanks for any
help.
 
J

Jon Spivey

Hi Richard,

I'd be tempted to forget the behaviors and code this manually. Try this -
First set up a class for your highlighted background colour, eg
<style type="text/css">
tr .highLight{
background-color:red;
}
<style>
add anything else you like then give your table an ID, eg
<table border="1" id="YourTable"....
then some script to change the whole row bg onmouseover

<script type="javascript">
function setUpTable(){
var t = document.getElementById('YourTable').getElementsByTagName('TR');
for(i=0;i<t.length;i++){
t.onmouseover=function(){this.className='highLight';};
t.onmouseout=function(){this.className='';};
}}
window.onload=setUpTable;
</script>

This will cause the current to change colour without needing to add
behaviours to each row seperately.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top