wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes On mouse over / On click events Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "On mouse over / On click events" Watch "On mouse over / On click events" New topic

On mouse over / On click events

sumanth kadaba

Joined: Jun 21, 2009
Posts: 27
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

Joined: Nov 08, 2001
Posts: 15376
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

BUT there is a better solution, no JavaScript is needed

Pure old CSS

sumanth kadaba

Joined: Jun 21, 2009
Posts: 27
Hi Eric,

Yes the CSS technique is there

Will try getting it done in script too.

I agree. Here's the link: http://aspose.com/file-tools
subject: On mouse over / On click events