473,326 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

href or onClick?

What is preferable?

<a href="javascript:my_function();">hyperlink</a>

or

<a href="#" onClick="my_function();">hyperlink</a>

--
http://www.archytas.nl/
webdesign, internet applicaties, internetgestuurde elektronica
Jul 23 '05 #1
3 6233
Lee
Roderik said:

What is preferable?

<a href="javascript:my_function();">hyperlink</a>

or

<a href="#" onClick="my_function();">hyperlink</a>\


<a href="pageExplainingThatJavascriptIsNotEnabled.htm l"
onclick="my_function();return false">hyperlink</a>

Returning false from the onclick handler is important
to prevent the link from being followed. Even if the
link is "#", that will cause most browsers to jump to
the top of the current page.

Jul 23 '05 #2
Ivo
"Roderik" wrote
What is preferable?

<a href="javascript:my_function();">hyperlink</a>

or

<a href="#" onClick="my_function();">hyperlink</a>


See the FAQ:
<URL: http://jibbering.com/faq/#FAQ4_24 >
Jul 23 '05 #3
Roderik wrote:
What is preferable?

<a href="javascript:my_function();">hyperlink</a>

or

<a href="#" onClick="my_function();">hyperlink</a>


Neither one is.
PointedEars
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Jez | last post by:
Hi, I've created a function which opens a popup window containing a calendar. When a day is clicked, the date is entered into a text box on the parent page and the popup is closed. The link...
11
by: Dana Smith | last post by:
Can anybody explain why when I have a hyperlink on a page with the code similar to below, after the user clicks on the link, the desired window opens but the page with the hyperlink changes to a...
0
by: Beto | last post by:
I am working on a project and I was thinking about implement ajax instead of using pure asp.net, however I've got a problem. The page: the page is like a google, yahoo or any other search...
1
by: nsvmani | last post by:
Hi, i am trying to get the FileOpen dialogue window as soon as clicked href link I am using IE6 with ActiveX enabled. Just need to get the File Open dialogue window when i click on the HREF links.It...
13
by: alvin.yk | last post by:
Hi, Normally, a piece of code such as <a href="http://www.yahoo.com" onclick="alert('hello');return false;">link</a> will stop the browser from actually going to href's destination....
3
by: Christoph | last post by:
I have set up the onclick event of an href so that it submits a form and returns false. I'm returning false to prevent the browser from actually going to the page. However, because I have the...
5
by: prathapavp | last post by:
hi all, We r working on ERP sys and am doing crossBrowser compatibility. The problem is am not able to load one function by onClicking the refrence text . could u please help me out.
7
by: Ellie | last post by:
I am trying to cancel a href by coding onclick="return false" in my page. I can put in a function and have a test "alert" box come up but the "return false" never works no matter what I try. Is...
5
by: dangt85 | last post by:
Hello, I have the following page: ... <style type="text/css"> body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.