
July 22nd, 2004, 05:06 PM
|
 |
Coconuts migrate?
|
|
Join Date: Feb 2004
Location: http://middle.nowhere.com
|
|
This one's gonna be tricky. First, I'd set the id of each cell according to its row and column. For example "r0c0" would be row 0, col 0, and "r3c5" would be row 3, col 5, etc. Now, in your javascript, you'll need to loop through, changing the specific elements. Something like this:
PHP Code:
<script type="text/javascript">
<!--
function changecol(colnum){
var el = ""; // "" makes it a string...
var MAXROWS = 10; // the number of rows you have in your table
for(var i = 0; i < MAX_ROWS; i++){
el = "r" + i + "c" + colnum;
document.getElementById(el).style.backgroundColor = '#CCCCCC';
}
}
// -->
</script>
Seems right in my head...
[edit]
Apparently "in my head" wasnt' so good. I fixed my code though...
Thre's a slightly easier way to do it, but this method is more self-explanatory.
[/edit]
__________________
Proud member of the T.S.N.B.U.F.L (tables should not be used for layout) alliance.
"Only use elements for their intended purpose. You wouldn't try to make coffee with a telephone, would you?" -Me
Last edited by TheJim01 : July 23rd, 2004 at 01:46 AM.
|