Solved

question about image disable in javascript

Posted on 2002-07-11
6
204 Views
Last Modified: 2010-08-05
hi i have a question about image disable.

actually i have a accept image in my asp page.if user enter character A In text box and he tabs out in onblur event i need to disable image so that user can't click on accept image.if any one have idea please help me.

Thanks in advance
abhi
0
Comment
Question by:abhis
6 Comments
 
LVL 3

Accepted Solution

by:
tejaspurani earned 50 total points
ID: 7146365
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script language=javascript>
function fnDisable(){
     document.all.item("img1").disabled = true;
     //document.getElementbyid("img1").disabled = true; for NS may be like this
}
</script>
</HEAD>

<BODY>
<input type=text name=txt1 onchange="fnDisable()" onblur="fnDisable()"><br>
<input type=image name=img1 id=img1 src="xyz.gif" onclick="javascript:alert();">
</BODY>
</HTML>
T.P.
0
 
LVL 3

Expert Comment

by:tejaspurani
ID: 7146371
some more code
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script language=javascript>
function fnDisable(){
     document.all.item("img1").disabled = true;
     document.all.item("img2").disabled = true;
     //document.getElementbyid("img1").disabled = true; for NS may be like this
}
</script>
</HEAD>

<BODY>
<input type=text name=txt1 onchange="fnDisable()" onblur="fnDisable()"><br>
<input type=image name=img1 id=img1 src="xyz.gif" onclick="javascript:alert();"><br>
<img name=img2 id=img2 src="xyz.gif" onclick="javascript:alert();">
</BODY>
</HTML>
T.P.
0
 
LVL 3

Expert Comment

by:tejaspurani
ID: 7148971
please comment.
T.P.
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 2

Expert Comment

by:mgaurav
ID: 7156242
Hi,


function fnDisable(){
    document.all.item("img1").disabled = true;
    document.all.item("img2").disabled = true;
    //document.getElementbyid("img1").disabled = true; for NS may be like this
}

may be changed for all browsers to simply:

function fnDisable(){
    document.formName.imageName.disabled = true;
}


  ALso, note that you WILL need to have a FORM before you can do all this stuff (<input ...>) in NS. Otherwise, NS's behaviour is unpredictable.


HIH,
mGaurav
0
 
LVL 12

Expert Comment

by:ahosang
ID: 8329302
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

points to tejaspurani
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
ahosang
EE Cleanup Volunteer
0
 

Expert Comment

by:modulo
ID: 8395543
Finalized as proposed

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

776 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