473,545 Members | 2,782 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

disabling image buttons

Hi everyone,

I'm new to javascript and have the following problem:
I have two image buttons:
1)
<td><a href="http://localhost/gamerules.php" target="mainwin dow"><img
onMouseOver="re turn changeRules()" onMouseOut="ret urn
changeRulesBack ()" name="b_rules" src="images/b_rules.jpg" width=130
height=90></a></td>
2)
<td><a href="http://localhost/playscreen.php" target="mainwin dow"><img
onMouseOver="re turn changePlay()" onMouseOut="ret urn changePlayBack( )"
name="b_play" src="images/b_play.jpg" width=130 height=85></a></td>

I need to do the following: when button 2 is pressed button 1 will
become disabled/unclickable, how do I get this kind of behavior?

thanks in advance for any help

Jul 23 '05 #1
3 2038

Well, simple:

<a href="http://localhost/playscreen.php"
onclick="docume nt.images['b_rules'].parentElement. removeAttribute ('href')"
target="mainwin dow"><img
onMouseOver="re turn changePlay()" onMouseOut="ret urn changePlayBack( )"
name="b_play" src="images/b_play.jpg" width=130 height=85></a>

Danny

On Sun, 26 Jun 2005 11:47:57 -0700, inonzuk <in*****@hotmai l.com> wrote:
Hi everyone,

I'm new to javascript and have the following problem:
I have two image buttons:
1)
<td><a href="http://localhost/gamerules.php" target="mainwin dow"><img
onMouseOver="re turn changeRules()" onMouseOut="ret urn
changeRulesBack ()" name="b_rules" src="images/b_rules.jpg" width=130
height=90></a></td>
2)
<td><a href="http://localhost/playscreen.php" target="mainwin dow"><img
onMouseOver="re turn changePlay()" onMouseOut="ret urn changePlayBack( )"
name="b_play" src="images/b_play.jpg" width=130 height=85></a></td>

I need to do the following: when button 2 is pressed button 1 will
become disabled/unclickable, how do I get this kind of behavior?

thanks in advance for any help


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Jul 23 '05 #2
thanks for the answer, another question is :
1)how can I start with image 1 clickable and image 2 unclickable, and
only after I click image 1 -> image 2 becomes clickable. (i.e.
starting with href empty on image 2 and setting its value when image 1
is clicked).

2)I want to change the image src when the image in unclickable. what is
the correct way to check it (I want to do a "if" condition ... if (href
is empty for that picture) change the src to unclickable image).

I want to do a function "onClick = doThis()"
function doThis(){
if (href is empty){
change the href to clickable link
change the image src to clickable button
}else{
change to empty href
(document.image s['b_ru*les'].parentElement. removeAttr*ibut e('href')")
change the image src to unclickable button
}
}

Jul 23 '05 #3

Well, images can do onclick, so, not sure on the <a> needed for the
linking, seems to me you can do all this using an onclick on the images, I
use the removeAttribute () in order to remove the 'href' and thus making it
not-hyperlink, however, you do all that with a function onclick of the
image and give the image style="cursor: pointer" to have the mouse change
as if it was a link, as for addressing the images, you can just give them
associative names, like name="image1" name="image2" and use the
document.images collection to iterate or access them, as in for
(i=0;i<3;i++) {.... document.images['image'+i].src='ANOTHERFI LE.png'; or
such.

Danny

On Sun, 26 Jun 2005 12:41:38 -0700, inonzuk <in*****@hotmai l.com> wrote:
thanks for the answer, another question is :
1)how can I start with image 1 clickable and image 2 unclickable, and
only after I click image 1 -> image 2 becomes clickable. (i.e.
starting with href empty on image 2 and setting its value when image 1
is clicked).

2)I want to change the image src when the image in unclickable. what is
the correct way to check it (I want to do a "if" condition ... if (href
is empty for that picture) change the src to unclickable image).

I want to do a function "onClick = doThis()"
function doThis(){
if (href is empty){
change the href to clickable link
change the image src to clickable button
}else{
change to empty href
(document.image s['b_ru*les'].parentElement. removeAttr*ibut e('href')")
change the image src to unclickable button
}
}


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Jul 23 '05 #4

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

Similar topics

0
3523
by: Philippe Meunier | last post by:
Hi, I am using the .NET toolbar with VB.NET 2003. My toolbar uses icons images that are actually PNG files and uses alpha blending on it. So to make alpha blending work correctly with the Toolbar and the Imagelist I had to use a tricky method with API calls that is described like this by a MS MVP : 1) Use v6 of the common controls (have...
5
5041
by: Lyn | last post by:
Hi, I hope someone can help. I have a main form which mostly fills the Access window. In the bottom half of this form I have a tab control to display various types of data related to the main form record. In each page of the tab control, there are three buttons: Add, Update, Delete. Any of these buttons will open another, smaller form...
0
1383
by: Dana Epp | last post by:
I have a ToolBarButton that when I set it to disabled (button.Enabled = false;) causes a really ugly gray masking effect to take place. This is normal and the intended way of the button, but I would like to clean it up. Instead of using the gray mask, I want to use my own grayscaled high quality image. I thought by simply setting...
1
2040
by: R.Balaji | last post by:
Hi, We are developing a windows application using c#. We have created a toolbar with some toolbar buttons. When we disable the toolbar button, the toolbar button image should be displayed as a grey image. But currently it blackout the image. (eg. if I put a smiley icon, then when the toolbar is disabled it just
1
1552
by: markeboy | last post by:
What is the workaround to prevent toolbar buttons from displaying a grey square where the image should be once the toolbar button is disabled I have transparent color of the image list set to transparent (after trying every other color) Toolbar images are set at design time - bound to an imagelist
1
1971
by: barq | last post by:
I'm using image in an anchor tag as a submit button. We use document.images.parentElement.removeAttribute('href') in a javascript function to make a image button non-clickable (not-hyperlink). How do we make it clickable again (have a hyperlink). Thanks in advance
3
3915
by: kayahr | last post by:
Hi there, I have a strange problem in Internet Explorer (IE6 and IE7). I'm writing a JavaScript application which allows the user to edit a photo composition. So when the user selects a photo then a frame is drawn around it with resize and rotate buttons. Now it happened to me that I replaced these buttons (32x32) with larger images (48x48)....
20
1245
by: Geoff Cox | last post by:
Hello, I am not at clear how to tackle this one. Say the note middle C is played, just once. Then when the user clicks on a play image a series of notes are played starting with middle C and the user the user has to say whether the last sound is the same as the first or different. There are 4 sets of this.
0
7499
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7432
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7689
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7456
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5359
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3490
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
743
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.