disable link that call to js function

Posted on 2007-03-25
Last Modified: 2008-02-01
I have links that call to JS function (<a href="javascript:runproc(window.document.mform)">).
I want to disable double clicking case.
i cant change the link but i can change the function (runproc).

there is a way to disable the link from the script? (using this.disable or something like that?)
i remind, i can't add id or something else to the href.. only change the script.

Thanks Ahead,
Question by:omribi
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1

Expert Comment

ID: 18788853
Not sure I quite understood your question, but here's my best shot:

To disable double click you need:

ondblclick = return false

To disable a link you can try out these:

Hope that helps.

Author Comment

ID: 18789190
What i mean is :
i dont have access to the dll that create the link.
i've access to the external JS that the link run.
i want to disable double click but i cant add anything to the link itself, only to the function it run.

i've added flag to the function, when it run first time it set it to true and then block 2nd time running.
but the problem is, when you press on the link 2nd time it stop the first submit...
so i want to disable the link so it won't stop the 1st submit.


Expert Comment

ID: 18789263
Ok, try putting this at the end of the function:

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

LVL 63

Expert Comment

ID: 18789701
The problem is that scripts started from href do NOT have a reference to the <a> tag. The reference to the anchor tag do scripts get only from event handler like onClick. There you can use that "this" reference.
But if the anchor with the function runproc() is called only once on the page, or the anchor can be identified by a name or else, then I would have a trick for you.


Author Comment

ID: 18803232
this.disabled - is not working, i can click on the link twice (the 2nd click disable the 1st action).
the JS function submit the form after validation, so the 2nd click stop the 1st submit and resubmit it.

I have title for this tag only.. i dont have name/id.


Expert Comment

ID: 18816644
Make a function that is called on loading the body to insert an onclick in the <a> tag. Make the onclick="return false;" and the user wil not jump when they click on the link.

Accepted Solution

Cyber-Drugs earned 250 total points
ID: 18816818

"i dont have access to the dll that create the link."

Unfortunately he can't follow your solution either, to be honest, I don't think this is possible without being able to edit the actual HTML code...
LVL 63

Assisted Solution

Zvonko earned 250 total points
ID: 18817021
You have no access to "this" because your script is called from href string and not from the link onClick event handler.
Can you change the call to this:

<a href="#" onClick="runproc(window.document.mform,this)">bla bla</a>


Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question