Solved

question about image disable in javascript

Posted on 2002-07-11
6
206 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
[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
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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

Independent Software Vendors: 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!

Question has a verified solution.

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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
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…

752 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