473,405 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

disable image until ....

Hello

I have for example

<IMG alt="image" id="IMG1" src="../images/play1.gif"
onClick="getSound(this);">

Can I disable this (stop onlick from working) until another action has
been completed?

I imagine I use

document.getElementById('IMG1').style.disabled = 'true';

but it doesn't stop the getSound() function from working ...

Cheers

Geoff
Jun 27 '08 #1
5 1861
Geoff Cox wrote on 14 apr 2008 in comp.lang.javascript:
Hello

I have for example

<IMG alt="image" id="IMG1" src="../images/play1.gif"
onClick="getSound(this);">

Can I disable this (stop onlick from working) until another action has
been completed?

I imagine I use

document.getElementById('IMG1').style.disabled = 'true';
You are inventing a language: CSS styles has no disable,
a img cannot be disabled as it has(!) no action.

Try:

notYet = true;
........
onClick="if (!notYet) getSound(this);"

or make the img not displayed by:

...style.display = 'none';
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 27 '08 #2
On Apr 14, 9:14*pm, Geoff Cox <g...@freeuk.notcomwrote:
Hello

I have for example

<IMG alt="image" id="IMG1" src="../images/play1.gif"
onClick="getSound(this);">

Can I disable this (stop onlick from working) until another action has
been completed?
One way is to add the click handler when the "other" action finishes.
Another is to set a variable and check its value when calling
getSound. Change its value when the other function runs so getSound
knows.

I imagine I use

document.getElementById('IMG1').style.disabled = 'true';
Don't guess, the disabled attribute is valid for BUTTON, INPUT,
OPTGROUP, OPTION, SELECT and TEXTAREA elements, not IMG:

<URL: http://www.w3.org/TR/html4/interact/...#adef-disabled >
--
Rob
Jun 27 '08 #3
On Mon, 14 Apr 2008 05:13:31 -0700 (PDT), RobG <rg***@iinet.net.au>
wrote:
>On Apr 14, 9:14*pm, Geoff Cox <g...@freeuk.notcomwrote:
>Hello

I have for example

<IMG alt="image" id="IMG1" src="../images/play1.gif"
onClick="getSound(this);">

Can I disable this (stop onlick from working) until another action has
been completed?

One way is to add the click handler when the "other" action finishes.
Another is to set a variable and check its value when calling
getSound. Change its value when the other function runs so getSound
knows.

>I imagine I use

document.getElementById('IMG1').style.disabled = 'true';

Don't guess, the disabled attribute is valid for BUTTON, INPUT,
OPTGROUP, OPTION, SELECT and TEXTAREA elements, not IMG:
Thanks Rob - I will try your suggestions.

Cheers

Geoff

>
<URL: http://www.w3.org/TR/html4/interact/...#adef-disabled >
Jun 27 '08 #4
On 14 Apr 2008 12:12:11 GMT, "Evertjan."
<ex**************@interxnl.netwrote:
>Geoff Cox wrote on 14 apr 2008 in comp.lang.javascript:
>Hello

I have for example

<IMG alt="image" id="IMG1" src="../images/play1.gif"
onClick="getSound(this);">

Can I disable this (stop onlick from working) until another action has
been completed?

I imagine I use

document.getElementById('IMG1').style.disabled = 'true';

You are inventing a language: CSS styles has no disable,
a img cannot be disabled as it has(!) no action.

Try:

notYet = true;
.......
onClick="if (!notYet) getSound(this);"

or make the img not displayed by:

...style.display = 'none';
OK - will try out these ideas.

What I really want is to disable the onClick not event not the image .

Cheers

Geoff
Jun 27 '08 #5
Geoff Cox wrote on 14 apr 2008 in comp.lang.javascript:
>>You are inventing a language: CSS styles has no disable,
a img cannot be disabled as it has(!) no action.

Try:

notYet = true;
.......
onClick="if (!notYet) getSound(this);"

or make the img not displayed by:

...style.display = 'none';

OK - will try out these ideas.

What I really want is to disable the onClick not event not the image .
Whet is an "onClick not event" ?

Perhaps putting some commas in the sentense would make it clear to me.

Are you still inventing the language and the event mechanism?

You cannot disable an html event listener.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 27 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Dennis Allen | last post by:
Hi. What's the best way to display an image, disabling the user's ability to right-click on it? I believe you have to use <body oncontextmenu="return false">. Would the following work? var...
4
by: Els | last post by:
Hi, I would like an opinion on the following: I have a page which is made up of background-images with transparent linked images in front of it, which on hover show text in CSS popups. Due to...
0
by: udir | last post by:
Hi all, I have a ToolBar on my form. Each button associated to an image from an ImageList. Why when I disable the button, the button becomes all gray ( and not grayscale image ) ? Do I...
1
by: Kamyar Souri | last post by:
How can I disable Image caching? I use ASP.NET Image web control that it's ImageUrl is constant but the image is being changed by the code. because of cachin I always see the same image in my...
9
by: junlia | last post by:
Does anyone how how can we disable the auto-postback feature in asp.net page? I have to use a server side control in the page, but the auto post back feature in it causes problems for me. Please...
1
by: wkerplunk | last post by:
On mouseover it goes to the correct map say TheMap1.jpg and then on mouseOut it defaults back to map, I need to do a onClick that sets the TheMap1.jpg mouseOver to the default TheMap.jpg so the...
4
by: tshad | last post by:
I have a page that has about 20 textboxes and dropdowns that I want to disable until a button is pushed. I don't want them to be hidden which I can do with <div visible=false runat=serveror...
8
by: boert89 | last post by:
Hi all, I've been trying to work this out myself for the last couple of weeks - I even asked my teachers in school, but no one could help. So you're my last chance. Thanks for any help in advance....
3
by: vaniKanabathy | last post by:
I had used toolbar to replace button usage in program . I had disable the image button in toolbar but it not displayed in a shaded mode when disabled. How can i do it because i want to differentiate...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.