PDA

View Full Version : Disabling a anchor tag using javascript



karthisys@yahoo.co.in
08-17-2006, 05:07 AM
hi,

I will explain my need pls give me a solutuion.

I got Some two or three anchor tags in a jsp page.While onclick of one <a href= ..> tag it is calling one of the javascript function some background process is going on.so upto that process it should not possible for the user to click other <a href=..> tags.

boogyman
08-18-2006, 02:26 PM
<a href="javascript:void(0)">BLAHBLAH</a>

mburt
08-18-2006, 02:44 PM
<a href="#" onclick="return false">BLAH BLAH BLAH</a>

Twey
08-18-2006, 03:06 PM
If no appropriate href can be given, a button should be used instead.

kencl
08-19-2006, 12:53 AM
He only wants to disable it temporarily.

You'll need a flag to keep track of whether or not the link should be active. Get your background process to set it to false until it's finished processing.

var Link_Enabled_Flag = false; // disable links - background process changes this to true when it's done

function Check_Link_Enabled{ return Link_Enabled_Flag; }

Then in your link just have <a href="wherever.com" onclick="return Check_Link_Enabled()">

Twey
08-19-2006, 03:44 AM
function Check_Link_Enabled(){ return Link_Enabled_Flag; }But yes, that's so.

mburt
08-19-2006, 04:01 AM
Brackets are important :)

kencl
08-19-2006, 07:51 AM
oops... my bad :()

srujana
04-13-2013, 08:23 AM
hai..i too want the code that..i have 10 anchor tags in a jsp page.if i click one anchor tag and the remaining 9 anchor tags must be disabled.is it possible in jsp's using javascript.please help me..iam waiting for ur reply..reply me soon

jscheuer1
04-13-2013, 04:17 PM
Yes. Just do as outlined in the above posts.