Solved

question about image disable in javascript

Posted on 2002-07-11
6
202 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
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…

744 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