| View previous topic :: View next topic |
| Author |
Message |
Koplaf
Joined: 28 May 2006 Posts: 130
|
Hello.
I have a list of news.
And till now the layout was solved with tables.
Each news was in a table row and had 3 extra events... onmouseover, onmouseout and onclick
I solved onmouse over and onmouse out with css and htc behaviours
For ie.
Now, how can I solve the onclick event?
I would like to optimize the code as much as possible. |
| |
|
|
|
|
autos06
Joined: 13 May 2006 Posts: 123 Location: New York
|
| It sounds like your question is "I'm doing something (but I won't tell you what) with JavaScript onclick, and now I want to do it another way. How can I do that?". If that is the question, then we really don't have enough information to make any suggestions. |
| |
|
|
Koplaf
Joined: 28 May 2006 Posts: 130
|
So instead of puttin onmouseclick=somefunction() to each DIV I'd like to make a function that will append this functio automaticall7y to all DIVs in let say <DIV id="news">
autos06, do you get what I'd like? is not what you suggested |
| |
|
|
autos06
Joined: 13 May 2006 Posts: 123 Location: New York
|
| Var divs = document.getElementById('news').getElementsByTagName('div'); for (var i = divs.length; i; i--) { divs[i].onclick = somefunction; } I guess. |
| |
|
|
Koplaf
Joined: 28 May 2006 Posts: 130
|
Nice
Somenthing like this, ye :D
But something like this I have to call onPageLoad, right? |
| |
|
|
autos06
Joined: 13 May 2006 Posts: 123 Location: New York
|
| Onload, yes. |
| |
|
|
Koplaf
Joined: 28 May 2006 Posts: 130
|
| Thanks alot for helping me out |
| |
|
|
|
|