?
Solved

disable link that call to js function

Posted on 2007-03-25
8
Medium Priority
?
482 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
[X]
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
8 Comments
 
LVL 4

Expert Comment

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

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


Hope that helps.
0
 

Author Comment

by:omribi
ID: 18789190
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
ID: 18789263
Ok, try putting this at the end of the function:


this.disabled=1;
0
Technology Partners: 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!

 
LVL 63

Expert Comment

by:Zvonko
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.


0
 

Author Comment

by:omribi
ID: 18803232
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
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.
0
 
LVL 4

Accepted Solution

by:
Cyber-Drugs earned 750 total points
ID: 18816818
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 750 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>



0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…
Suggested Courses

770 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