Forum Moderators: open
<a href='#' onClick='java.function()'>
I see lots other sites use it working (runs the function) and not trying to run the #. but when I use it it always goes to
currentpage.html# - or the start page of the code, and looks for a anchor instead, & opens the page like a directory.
thsi is in fastbrowser and IE55, Have tried null and #null too, tries to find those current links, too. I need it to ignore the href totally, go to function.
thanks
1.
<a href="javscript:function()">link</a>
This is the most common as it avoids any problems with the #, however sometimes you don't want a JS function to fire from the href as you can't grab the 'event'. If you need to grab the event then you can use:
2.
<a href="javascript:;" onClick="function()">link</a>
The javascript:; is basically saying run nothing here. The onClick event doesn't require the javascript: as JS is expected in events. If you use the # instead of javascript:; browsers like IE will always jump to the top of the page.