Connecting Tech Pros Worldwide Forums | Help | Site Map

Javascript Hyperlink Function is Called Twice

Newbie
 
Join Date: Sep 2008
Posts: 4
#1: Sep 2 '08
I am using <a href="javascript:someFunction('someValue','someVal ue2')"> Click here </a>

But when i clicked on it, it actually call the "someFunction" function twice.
This only happen to Mozilla Browser. IE only called once.

Kindly advise what is wrong with this method?
10,000 Thank you!!

Regard,
Jason

RamananKalirajan's Avatar
Needs Regular Fix
 
Join Date: Mar 2008
Location: Chennai - India
Posts: 350
#2: Sep 2 '08

re: Javascript Hyperlink Function is Called Twice


Hi Kai, I tried this code in IE as well as Mozilla I am getting that someFunction() called only once. can u please tell in which version of mozilla u got the call twice

Regards
Ramanan Kalirajan
Newbie
 
Join Date: Sep 2008
Posts: 4
#3: Sep 3 '08

re: Javascript Hyperlink Function is Called Twice


Quote:

Originally Posted by RamananKalirajan

Hi Kai, I tried this code in IE as well as Mozilla I am getting that someFunction() called only once. can u please tell in which version of mozilla u got the call twice

Regards
Ramanan Kalirajan

Hi Ramanan,

Thanks for your prompt reply!

I tried both v2 and v3 of mozilla browser and both the same.
I had google-ing about this problem and realised that it happened to others too.
[removed link]
However, i cannot find a link which provide a workable solution.
Sorry, I am still new in web application deverlopment.
Hope to hear from you again soon!
Thank you.

Regards
Kai
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#4: Sep 3 '08

re: Javascript Hyperlink Function is Called Twice


Post the code for someFunction. As a general rule, you should put JavaScript in onclick and put a real URL in the href attribute.
Newbie
 
Join Date: Sep 2008
Posts: 4
#5: Sep 12 '08

re: Javascript Hyperlink Function is Called Twice


Quote:

Originally Posted by acoder

Post the code for someFunction. As a general rule, you should put JavaScript in onclick and put a real URL in the href attribute.


Hi Acoder,

Thanks for the help, i am a very new developer for my current company.
Thus, i don't have the right to review any of my company's codes to anyone.
I am very sorry for that... however, with the help of my senior developer, we found out that the problem is not lie in the javascript but the <frame> tag.
It called itself again when we have something like <frame src="">.
We have tried to put <frame src="#"> or <frame src="dummy.htm"> but none of the solution works. We will try again with other methods.
Thanks again for everyone who have help up. :)

Regards,
Jason
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#6: Sep 12 '08

re: Javascript Hyperlink Function is Called Twice


What does someFunction() do? Can you not just post the relevant part of the code?
Reply