Solved

disable link that call to js function

Posted on 2007-03-25
8
472 Views
Last Modified: 2008-02-01
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
Comment
Question by:omribi
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 4

Expert Comment

by:Cyber-Drugs
Comment Utility
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
 

Author Comment

by:omribi
Comment Utility
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
 
LVL 4

Expert Comment

by:Cyber-Drugs
Comment Utility
Ok, try putting this at the end of the function:


this.disabled=1;
0
 
LVL 63

Expert Comment

by:Zvonko
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:omribi
Comment Utility
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
 
LVL 2

Expert Comment

by:rhawk
Comment Utility
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
 
LVL 4

Accepted Solution

by:
Cyber-Drugs earned 250 total points
Comment Utility
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
 
LVL 63

Assisted Solution

by:Zvonko
Zvonko earned 250 total points
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now