473,555 Members | 2,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Anchor element follows HREF even though onClick returns false

I have a page with a button that has the following link:

<a href="/somelink?org.ap ache.struts.tag lib.html.TOKEN= ef9f9f5973be37f fe39c60227f4027 70#"
onclick="javasc ript:go( event, 'myForm');retur n false;">

The go() function submits a form and returns false. This is definately
working.

The problem is that on some peoples' computers ( only a rare few, that
have different OS's and browsers ) this link follows the HREF and goes
to "/somelink?..." instead of proceeding to the action inside of the
form.

I've identified that a fix to this problem is to replace to
'href="/somelink?..."' with 'href=#', though I don't know why this is
only a problem on some computers.

Has anyone else seen this in the past? I'm thinking there might be an
issue with popup-blockers... or some other third-party software.

Any information would be appreciated, thanks.
Jul 20 '05 #1
4 9870
"Johnny" <ja*********@ya hoo.com> wrote in message
news:64******** *************** ***@posting.goo gle.com...
<snip>
onclick="javas cript:go( event, 'myForm');retur n false;">

The go() function submits a form and returns false. This is
definately working.
The - go - function is a one of yours?
The problem is that on some peoples' computers ( only a rare
few, that have different OS's and browsers ) this link follows
the HREF and goes to "/somelink?..." instead of proceeding to
the action inside of the form.

<snip>

If an error occurs within the - go - function then JavaScript execution
will terminate and the event handling function will not return a value.
So the navigation within the HREF will be followed (that will also be
the case when JavaScript is not available on the client).

Obviously without seeing the code within the - go - function, or the
HTML it is interacting with, speculating as to whether, or how, it might
be erroring would be futile.

Richard.
Jul 20 '05 #2
In article <64************ **************@ posting.google. com>, jazzman_
33*@yahoo.com enlightened us with...
I have a page with a button that has the following link:

<a href="/somelink?org.ap ache.struts.tag lib.html.TOKEN= ef9f9f5973be37f fe39c60227f4027 70#"
onclick="javasc ript:go( event, 'myForm');retur n false;">

Don't put "javascript :" in an event handler. An event handler is already
script.
The go() function submits a form and returns false. This is definately
working.


Is it working in the problem browsers/OSs?
See Richard's post. If it's broken in some situations and "go" is
undefined (which is what happens in some browsers when a function has an
error), the browser may ignore the function.

If taking out the href were an option, why is it there?
Most of us put it there to support old browsers or browsers with no
script. If you don't need it (intranet, cd, etc), don't use it.

--
--
~kaeli~
Support your local medical examiner: die strangely!
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #3
kaeli <ti******@NOSPA M.comcast.net> wrote in message news:<MP******* *************** **@nntp.lucent. com>...
In article <64************ **************@ posting.google. com>, jazzman_
33*@yahoo.com enlightened us with...
I have a page with a button that has the following link:

<a href="/somelink?org.ap ache.struts.tag lib.html.TOKEN= ef9f9f5973be37f fe39c60227f4027 70#"
onclick="javasc ript:go( event, 'myForm');retur n false;">


Don't put "javascript :" in an event handler. An event handler is already
script.
The go() function submits a form and returns false. This is definately
working.


Is it working in the problem browsers/OSs?
See Richard's post. If it's broken in some situations and "go" is
undefined (which is what happens in some browsers when a function has an
error), the browser may ignore the function.

If taking out the href were an option, why is it there?
Most of us put it there to support old browsers or browsers with no
script. If you don't need it (intranet, cd, etc), don't use it.

--


Thank you both for your posts.

The reason I didn't provide the source to the go() function is that it
is not even getting executed. When the user click's the image this
anchor tag wraps, the go() function is not even being executed, the
browser follows the HREF immediately.

Kaeli, to answer your first question, yes, everything works on the
problem browser/OS after replacing the HREF with '#'. But, the
interesting part is that without replacing the HREF, everything works
on the same OS/browser on other machines. For some reason, this
machine is different, and that's what I'm trying to nail down... what
could be different? I was hoping that it would be a popup blocker, but
I was unable to find one.

To answer your second question, there is no logical reason for the
HREF to be there. I'm just troubleshooting the issue, but after
speaking with the developers, it seems that the HREF really has no
value. So, it will be removed either way.
Jul 20 '05 #4
In article <64************ **************@ posting.google. com>, jazzman_
33*@yahoo.com enlightened us with...

Kaeli, to answer your first question, yes, everything works on the
problem browser/OS after replacing the HREF with '#'. But, the
interesting part is that without replacing the HREF, everything works
on the same OS/browser on other machines. For some reason, this
machine is different, and that's what I'm trying to nail down... what
could be different? I was hoping that it would be a popup blocker, but
I was unable to find one.


I wouldn't think so, as most popup blockers I know of only block popups
that were NOT the direct result of a user action (IE). That is, if a
function from onClick opens a window, it's cool. If a function calls
another function that opens a window, it's blocked.
This is IME from using the blockers, so I could be totally off base
here.

I wonder if the browser settings are the same...
--
--
~kaeli~
Jesus saves, Allah protects, and Cthulhu thinks you'd make
a nice sandwich.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #5

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

Similar topics

1
8319
by: Stanimir Stamenkov | last post by:
Here's an example: <form action="bogus" method="post"> <p> <a href="prev.cgi"><input type="submit" name="prev" value="< Back"></a> <a href="next.cgi"><input type="submit" name="next" value="Next >"></a> </p> </form>
8
1980
by: saif | last post by:
Hi all, I realy need your help. I have a page with different web links, now what I am trying to do is whenever a user clicks on a link that link is captured using event.target method. I'm using this to process that URL, but the real part is stopping the document from loading that URL. I tried stop() method but its not working. I also...
4
3442
by: deko | last post by:
I use named anchors to take users to specific parts of a long page. But I want to add some processing and do some things with my nav bar when users go to certain sections delineated by named anchors. I understand that the anchors array creates an element for each anchor in the page when the page is loaded, but how do I identify which anchor...
2
1636
by: Will | last post by:
(My 4 questins at end after explination) The code below was provided to me to "Popup" a window explaining what a Credit Card Verification Number is and where to find it on a card... it is used as people enter their credit card info on an ecommerce site. This is the first such site (Shopping Cart) I have done and this code was provded by a user...
11
12569
by: yawnmoth | last post by:
If using an onclick event handler to execute javascript when an anchor element is clicked on, what should the href attribute be? #? javascript:void(0)? Something else?
6
2086
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 element via jscript. How do I do this? I am attempting to prevent extra trips to the server. Currently, I set the navigateurl in server side...
13
2515
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 window.location.href to include the #. FF does. (eg) <a href="#moo" onclick="alert('moo'); return false;"> After clicking in IE, location bar in browser...
9
2126
by: Jan Eliasen | last post by:
Hi This problem is a little but difficult for me to explain, but I hope you will get the idea. I have some javascript code, where I: document.getElementById(el).style.display=""; document.getElementById(el).scrollIntoView(true); so basically, the element was hidden, but I am setting it to
20
1967
by: Prisoner at War | last post by:
Hi, People, Is it possible to have an "empty" or "dummy" <a href***without*** the browser jumping back up the page?? I have a hyperlink that doesn't point to another document, but is used to call forth a modal window onClick (or is there another way, without text or image links, of calling forth JavaScript on user activity??). I would...
0
7547
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7825
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8060
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7588
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7904
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6176
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5171
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1159
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.