Philadelphia Reflections

The musings of a physician who has served the community for over six decades

Related Topics

Website Development
The website technology supporting Philadelphia Reflections is PHP, MySQL and DHTML. The web hosting service is Internet Planners. The development of this website has provided an opportunity to learn new technology, to try out different techniques for getting noticed by the search engines and the trials and tribulations of dealing with malicious hackers and spammers who range from the annoying to the abusive. This collection of articles documents some of our experiences and we hope that people surfing the web looking for solutions to problems we've encountered will benefit.

George IV and Computers(1)
I got him into computers around 1960. He soon far surpassed me.

Program notes by GRF4

HTML Anchor without an HREF?

Sometimes I want to execute a JavaScript function when a user clicks a link, but nothing else.

If I omit the href entirely, the cursor doesn't change and some browsers don't recognize the text as a link:

<a onclick="function();">

If I include the pound sign, which seems to be a very popular trick, I get sent to the top of the current page, which messes up both History and the backspace button; to say nothing of the fact that I don't want to jump to the top of the page:

<a href="#" onclick="function();">

Including the function in the href and omitting the onclick seems to be the answer to my specific problem:

<a href="javascript: function();">

Once again, my thanks to for HTML encoding.

Originally published: Friday, April 04, 2008; most-recently modified: Monday, June 04, 2012

instead of one or the other use both, then it works in FF

this is my example;

a href="javascript:return openCenteredWindow('index/process.php');" onclick="return openCenteredWindow('index/process.php');"
Posted by: this is how   |   Oct 20, 2008 3:46 AM
"in the FF"?

Firefox? Works perfectly in mine, what version are you using? Do you have JavaScript enabled?
Posted by: g4   |   Jun 17, 2008 10:02 AM
Unfortunately in the FF it doesn't work
Posted by: Maxim   |   Jun 17, 2008 4:39 AM