![]() Preserved Topic: this.bgColor='#000000' (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: |
![]() does anybody know how to set it so that when someone mousovers a table that bit of the table has a diferent background normally i would use onmousover="this.bgColor='#000000'" but i would not know how to set it up in a script can anyboy help? |
Paranoid (IV) Inmate From: France |
![]() EDII: Welcome in the Asylulm, code: <td onmouseover="this.style.backgroundColor="#000000"' onmouseout="this.style.backgroundColor="#ffffff"'>lorem lipsum</td> Otherwise, if you can take the CSS road ( at the cost of leaving aside IE and its lousy support of CSS ), you can simply do : code: <style type="text/css"> And avoid to add some unecessary JavaScript in your structural markup. |
Neurotic (0) Inmate Newly admitted From: |
![]() hi there, Im new here.. :) |
Maniac (V) Inmate From: under the bed |
![]() Then you will need to set up a function, most likely storing the id's of the td's in an array, and you would call that function with the relevant arguments in the onmouseover=".." bit. |
Nervous Wreck (II) Inmate From: Perth Western Australia |
![]() quote:
|
Bipolar (III) Inmate From: Berlin (almost) |
![]() I thought this would be the perfect situation in which this.nextSibling and this.previousSibling would come in handy (as they allow you to avoid setting an ID for each and every single TD) and just came up with this function: code: function changeRowColor(cell, color) {
|
Nervous Wreck (II) Inmate From: USA |
![]() Is it possible to grab the entire <tr> and background-color that? |
Bipolar (III) Inmate From: Berlin (almost) |
![]() D'uh... of course! So much easier this way: code: function changeRowColor(row, color) {
|
Paranoid (IV) Inmate From: France |
![]() quote:
code: function changeRowColor( cell, color ) But indeed, the suggestion of Iron Wallaby makes perfect sense. |
Bipolar (III) Inmate From: Berlin (almost) |
![]() Aaaah I see - thanks for that, poi! |
Neurotic (0) Inmate Newly admitted From: |
![]() Thanks a lot! You guys are really nice and helpful :) |