Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

On mouse over / On click events

 
sumanth kadaba
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am trying to code a html page which is compatible across browsers.

have a look at the code


Pardon me for the coding standards..
Basically my header of the table will contain a link. I planned to make the whole header "clickable".
so on mouse over I change my cursor to hand and then keep an onclick event so that I can navigate to the url.


Now I tested this in

Fire Fox(2,3) : work's fine.
IE (6,7,8): Refuses to behave in the desired fashion.

I did read about this problem, but I was unable to figure out.

I also tried onmouseover instead of onMouseOver, onclick instead of onClick.

Kindly advise on the event handling.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should not use setAttribute for setting events, an event handler is not an attribute.

Here is how you should add an event if you are not using a library such as jQuery
http://www.scottandrew.com/weblog/articles/cbs-events


BUT there is a better solution, no JavaScript is needed



Pure old CSS


Eric
 
sumanth kadaba
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric,

Yes the CSS technique is there

Will try getting it done in script too.

Thanks,
Kadaba
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic