|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#1
|
|||
|
|||
|
JS table mouseover colorchange
Hey all
Am currently trying to write some table mousover effects. Am quite new to JavaScript, so I think it's some n00b-prob I have here. Well, wrote some code which is successfully changing the class of a row in a table. it looks like this Code:
...
tr.Highlight {
background-color: lightblue;
cursor:pointer;
}
...
Code:
...
function Highlight(id) { id.className='Highlight' }
...
in HTML: Code:
... <tr onmouseover="Highlight(this)"> ... Well, I tried to make it more usable, e.g. also for single cells and for css-classes i may define in the HTML-code. Changed it like this: Code:
...
tr.Highlight {
background-color: lightblue;
cursor:pointer;
}
...
Code:
...
function Highlight(id,cssclass) { id.className=cssclass }
...
in HTML: Code:
... <tr onmouseover="Highlight(this,Highlight)"> ... But like this it's not working anymore. What did I do wrong? IE-debug tells me, Highlight is undefined. Tried if it works if I remove the tr in the css, but anyways it keeps giving out this error msg. Think it's really some stupid newb-mistake. Pls help me |
|
#2
|
|||
|
|||
|
RE: JS table mouseover colorchange
Still don't know why it's not working, but found a work-around. Instead od declaing a function, i'm putting this into the tag:
Code:
<tr onmouseover="this.className='cssclass'" onmouseout="this.className=''"> it's working fine! |
|
#3
|
|||
|
|||
|
RE: JS table mouseover colorchange
And also resolved, why the different thing was not working.
Code:
<tr onmouseover="Highlight(this,Highlight)"> should be Code:
<tr onmouseover="Highlight(this,'Highlight')"> then it works! |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > JS table mouseover colorchange |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|