473,769 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Colour change OnClick

Is it possible to have a button change colour OnClick ?

Thanks.
Nov 13 '05 #1
2 6629
Di
Scott wrote:
Is it possible to have a button change colour OnClick ?

Thanks.


Hi Scott,
Buttons do not have the background colour property so you can't
change their colour (pity). What I have used in the past is boxes, they
have an OnClick event that you can use to simulate a command button.

They however do not have a tab stop property so you may not be able to
bring them into focus without directly clicking on them. You can use
them in conjunction with the command button and use the visible
property to alternate between them.

Good Luck,
D...

Nov 13 '05 #2
The OP can change the color of the CommandButton control during the
Click event. THe simplest method is to have a hidden CommandButton
control containing a single color Bitmap. During the Click event you
could use code like:

Me.TheNameofThe CurrentCommandB utton.PictureDa ta =
Me.TheNameOfthe HiddenCommandBu tton.PictureDat a

A solution to allow you to specify the BackGround color of
COmmandButtons is here:
http://www.lebans.com/cmdbutton.htm
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Di" <di************ @bpb-na.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Scott wrote:
Is it possible to have a button change colour OnClick ?

Thanks.
Hi Scott,
Buttons do not have the background colour property so you can't
change their colour (pity). What I have used in the past is boxes,

they have an OnClick event that you can use to simulate a command button.

They however do not have a tab stop property so you may not be able to
bring them into focus without directly clicking on them. You can use
them in conjunction with the command button and use the visible
property to alternate between them.

Good Luck,
D...


Nov 13 '05 #3

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

Similar topics

1
9342
by: John D | last post by:
I am trying to change the background colour of either a div or a textarea with javascript, but am having problems. I have passed a hex colour value in the variable hval, and with the following code can change the background colour of the whole page, but only (now) want to change either a textarea of a form or a div. I'm stuck. document.bgColor = hval;
3
14695
by: NeoPhreak | last post by:
I am creating a menu for my site and I would like it so that when the onMouseOut even is triggered it will cause the cell of the table to fade out back to the normal color with a delay. Can anyone help me to get started on how i would accomplish this?
1
4577
by: Alistair Birch | last post by:
Hi I want rows of a table to appear in alternating background colours. Having looked around the web I can't find any solution apart from waiting for the next version of CSS, so I tried building one myself, but I need some help to finish it. I use the getAttribute('rowIndex') to return the position of a row within the table and apply modulo 2 to return a 0 or 1 indicating an even or odd row number, from which I apply the alternating...
6
5236
by: Louise | last post by:
Hi I have written an HTML pages which does not have any colour specifying tags as far I know. When I view this in an Microsoft internet explorer browser it appears with a white background and black text but when I change Windows start menu->settings->control panel ->display -> appearance and change scheme to 'High Contrast Black' the background in the browser changes to black and the text to white. I understand that the windows scheme...
1
2297
by: ms | last post by:
Hi, I've been trying to find a way to change a cell's colour when clicking it. What I've found so far is to change the background colour by using: function whenClick(navElm) { var state1 = '#0000FF'; if(navElm.style.backgroundcolor != state1){ navElm.style.backgroundcolor = state1; } } My problem is, first it does not work when I used <td bgcolor="#00FFFF" id ="s2"
6
2797
by: Lapchien | last post by:
One of my users has asked that a form change it's colour if a particular yes/no box is ticked - possibly made a bit more tricky because the form is tabular..? Thanks, Lap
0
1792
by: llarryllama | last post by:
I'm using this script (see below) that I found here on thescripts and it's working perfectly. It's to change text color of a "visited link" back to unvisited color. The problem is that to make the visitor understand the structure of the navigation, the top link has to be it's active colour on page load. I've tried a script that makes a link active on page load but it also creates an ugly frame around it and also makes this script a bit buggy....
10
3490
by: Pulzar | last post by:
Hi there, I want to show a simple image on a web page, and allow the viewer to select and change one of the colours used in the image, and immediately preview the result. I'd like to keep the image processing away from the server to make the colour selection/preview process quicker, and I also don't want to pre-generate all possible images as there are too many colours that can be selected. Does JS (or any JS libraries) provide image...
7
2841
by: Tristán White | last post by:
Hi there, this'll be an easy one I'm sure. I have a small question that will take a second to answer, I am sure. If you go to http://snipurl.com/t821 All the buttons on the left are red, and when the mouse hovers over them, they go green. How do I make it so that the buttons stay on green (or indeed any other colour) after being selected? So that the visitor knows which page he or she
0
9586
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10210
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10043
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7406
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6672
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.