• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 486
  • Last Modified:

disable link that call to js function

Hi,
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,
Omri
0
omribi
Asked:
omribi
  • 3
  • 2
  • 2
  • +1
2 Solutions
 
Cyber-DrugsCommented:
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:

http://www.webmasterworld.com/forum91/4831.htm


Hope that helps.
0
 
omribiAuthor Commented:
HI,
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.

Thanks,
Omri
0
 
Cyber-DrugsCommented:
Ok, try putting this at the end of the function:


this.disabled=1;
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
ZvonkoSystems architectCommented:
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.


0
 
omribiAuthor Commented:
Hi,
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.

Omri
0
 
rhawkCommented:
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.
0
 
Cyber-DrugsCommented:
rhawk:

"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...
0
 
ZvonkoSystems architectCommented:
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>



0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now