473,386 Members | 1,997 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,386 software developers and data experts.

href and onclick property of anchor tag.

dmjpro
2,476 2GB
Today i encountered a problem with anchor tag in IE 6.
Basically it is told that ... we should write ..

Expand|Select|Wrap|Line Numbers
  1. <a herf="javascript:void(0);" onclick="function_call(..);return false;">Display Name</a>
Why it is suggested? If inside that function call if i try to change the href value that window then it does not work if i don't have return false statement after function call. If i have that then it works. But if i have return false inside the function then it also does not work. Why does it happen ?
Sep 24 '08 #1
2 14213
Dormilich
8,658 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. onclick="function() {return false;}" --> onclick="false"
  2. onclick="return function() {return false}" --> onclick="return false"
  3. // compare to
  4. onclick="function() {...}; return false;" --> onclick="{some action}; return false;"
these are two different statements

I think it has something to do with the fact that both the event and the hypertext reference fire on click.
Sep 24 '08 #2
dmjpro
2,476 2GB
Expand|Select|Wrap|Line Numbers
  1. onclick="function() {return false;}" --> onclick="false"
  2. onclick="return function() {return false}" --> onclick="return false"
  3. // compare to
  4. onclick="function() {...}; return false;" --> onclick="{some action}; return false;"
these are two different statements

I think it has something to do with the fact that both the event and the hypertext reference fire on click.
Oh Shit!
Sorry i could have explained myself ...shame on me ... :(
Anyway thanks ....
Sep 24 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Christian Radermacher | last post by:
Hi, the following code has the mentioned behaviour: <html> <head> <script type="text/javascript"> function newA() { for (i=0;i<3;i++) { var a = window.frames.document.createElement("a");
4
by: Johnny | last post by:
I have a page with a button that has the following link: <a href="/somelink?org.apache.struts.taglib.html.TOKEN=ef9f9f5973be37ffe39c60227f402770#" onclick="javascript:go( event, 'myForm');return...
10
by: Bill H | last post by:
I used a bit of JS on a page that is fairly long and didn't like the way that <A HREF='#' ONCLICK=\"... refreshed the page to the top. Removing the HREF (<A ONCLICK=\"...) solved my...
4
by: Jerry Sievers | last post by:
JS Programmers, "I'm a server-side coder PHP, Postgres etc... My question; Given the following anchor <a href="http://www.somesite.com/somefile.html">link text</a> Is there a way to code an...
1
by: james.kingston | last post by:
I've read that one must return false from an onclick handler attached to an anchor if we wanted to prevent the browser from following the href. In a greasemonkey script I'm hacking together with...
6
by: eswanson | last post by:
In jscript, I would like to be able to set the href attribute of the anchor element. I have a aspnet:hyperlink button on the page, but I would like to be able to set the href attribute of this...
13
by: Logos | last post by:
There seems to be a serious difference between how FF an IE handle an anchor with an href containing a # and an onclick event. If the onclick event returns false, IE does not change...
10
by: Edwin Knoppert | last post by:
I have an asp.net imagebutton with a clickevent. I have enclosed an anchor around the image and a small text. If i click the image the event is executed (while the href of the anchor shows in the...
2
by: Peter Laman | last post by:
In my app I need to dynamically generate a series hyperlinks. Each hyperlink's action must be to focus a field in a <form>. I created the following function to create such a link (the argument is a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.