Hello, I want to have links on my page that actually call a JavaScript function. I can do this by writing- <A onClick="foo()">Click Me!</A> HTML: But when I write this what happens is that the 'a:hover' code that I had written in the CSS file does not have anny effect on the link. If I write something inside the HREF="" then only does it have any effect. But I cannot call the JavaScript function by writing it inside HREF. What do I do so that I can call a function of JavaScript without losing the effect that the CSS should have. Thanking You, Prateek Saxena
In addition to what missdanni said, you can have the function return false so JS-enabled browsers will not risk having the page jump.
The "return false;" is great for accessibility, if you want to open popup but if browser dont support js so it will open in the same window ex. <a href="bla.html" onclick="popup(this.href);return false;">Bla bla bla</a> HTML: