Solved

question about image disable in javascript

Posted on 2002-07-11
6
207 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…
Suggested Courses

615 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