Solved

question about image disable in javascript

Posted on 2002-07-11
6
203 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Popup to change image and store url in database 2 30
Animated .jpg? 13 60
Download a website to hdd 2 50
Materializecss - Different Behaviors in Browser's 1 20
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

920 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