I'm trying to set a submit button to change text and color when clicked.
Like saying "please wait" instead of "submit" and then changing the
background color and text color. All works, except for changing the text
color.
I can set style.backgroun d='red' to change the background color to red.
But if I say style.color='gr een' to change the text color, it does not
change. How do you change the text color on a button when it is clicked? 5 26998
In article <Oz************ ******@twister. socal.rr.com>, DE************* ***********@yah oo.com enlightened us with... I'm trying to set a submit button to change text and color when clicked. Like saying "please wait" instead of "submit" and then changing the background color and text color. All works, except for changing the text color.
I can set style.backgroun d='red' to change the background color to red. But if I say style.color='gr een' to change the text color, it does not change. How do you change the text color on a button when it is clicked?
Funny, it worked fine for me in IE6 and NN7.2.
What browser are you trying to get it to work in? It won't work in all
browsers, though it should work in all that support the element.style
property AFAIK.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title> New Document </title>
<script type="text/javascript" language="javas cript">
function changeBtn(btn)
{
if (! btn.style)
{
alert("Sorry, your browser doesn't support this operation.");
return;
}
btn.style.backg round = "red";
btn.style.color = "blue";
return;
}
</script>
</head>
<body>
<form id="f1" name="f1" action="" method="">
<br>
<input type="button" value="Try me" onClick="change Btn(this)">
</form>
</body>
</html>
--
--
~kaeli~
Humpty Dumpty was pushed! http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace
IE6
Here's the code:
<input type="submit" name="btnSubmit " value="Next" id="btnSubmit"
onclick="this.v alue = 'Please wait...';this.d isabled =
true;this.style .color='Green'; this.style.back ground='Red'"
style="color:Wh ite;background-color:#336699;f ont-weight:bold;wid th:150px;"
/>
"kaeli" <ti******@NOSPA M.comcast.net> wrote in message
news:MP******** *************** *@nntp.lucent.c om... In article <Oz************ ******@twister. socal.rr.com>, DE************* ***********@yah oo.com enlightened us with... I'm trying to set a submit button to change text and color when clicked. Like saying "please wait" instead of "submit" and then changing the background color and text color. All works, except for changing the
text color.
I can set style.backgroun d='red' to change the background color to red. But if I say style.color='gr een' to change the text color, it does not change. How do you change the text color on a button when it is
clicked?
Funny, it worked fine for me in IE6 and NN7.2. What browser are you trying to get it to work in? It won't work in all browsers, though it should work in all that support the element.style property AFAIK.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <head> <title> New Document </title> <script type="text/javascript" language="javas cript"> function changeBtn(btn) { if (! btn.style) { alert("Sorry, your browser doesn't support this operation."); return; } btn.style.backg round = "red"; btn.style.color = "blue"; return; } </script> </head>
<body> <form id="f1" name="f1" action="" method=""> <br> <input type="button" value="Try me" onClick="change Btn(this)"> </form> </body> </html>
-- -- ~kaeli~ Humpty Dumpty was pushed! http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace
In article <G4************ *****@twister.s ocal.rr.com>, DE************* ***********@yah oo.com enlightened us with... IE6
Here's the code:
<input type="submit" name="btnSubmit " value="Next" id="btnSubmit" onclick="this.v alue = 'Please wait...';this.d isabled = true;this.style .color='Green'; this.style.back ground='Red'" style="color:Wh ite;background-color:#336699;f ont-weight:bold;wid th:150px;" />
It's because you're disabling it.
It worked fine without that disabling bit in there.
It's an IE thing. Worked fine in NN7 either way. So, I'd say in IE you
can't override the font color of a disabled element.
--
--
~kaeli~
Those who jump off a bridge in Paris... are in Seine. http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace
In Internet Explorer, once you set disabled = true on a button, you have no
control over the text color. IE "greys" the text out (Opera 7.52 appears to do
this as well).
Your code works in Gecko-based browsers: Netscape 7, Firefox, Mozilla, Camino,
etc.
AFN wrote: IE6
Here's the code:
<input type="submit" name="btnSubmit " value="Next" id="btnSubmit" onclick="this.v alue = 'Please wait...';this.d isabled = true;this.style .color='Green'; this.style.back ground='Red'" style="color:Wh ite;background-color:#336699;f ont-weight:bold;wid th:150px;" />
"kaeli" <ti******@NOSPA M.comcast.net> wrote in message news:MP******** *************** *@nntp.lucent.c om... In article <Oz************ ******@twister. socal.rr.com>, DE************* ***********@yah oo.com enlightened us with... I'm trying to set a submit button to change text and color when clicked. Like saying "please wait" instead of "submit" and then changing the background color and text color. All works, except for changing the text color.
I can set style.backgroun d='red' to change the background color to red. But if I say style.color='gr een' to change the text color, it does not change. How do you change the text color on a button when it is clicked?
Funny, it worked fine for me in IE6 and NN7.2. What browser are you trying to get it to work in? It won't work in all browsers, though it should work in all that support the element.style property AFAIK.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <head> <title> New Document </title> <script type="text/javascript" language="javas cript"> function changeBtn(btn) { if (! btn.style) { alert("Sorry, your browser doesn't support this operation."); return; } btn.style.backg round = "red"; btn.style.color = "blue"; return; } </script> </head>
<body> <form id="f1" name="f1" action="" method=""> <br> <input type="button" value="Try me" onClick="change Btn(this)"> </form> </body> </html>
--
Grant Wagner <gw*****@agrico reunited.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq
Hi. Thanks to you and Kaeli for good information. I would not have
guessed about this disabled thing. And old posts didn't turn up this
either. Hopefully someone will find this thread in the future when they're
stuck!
"Grant Wagner" <gw*****@agrico reunited.com> wrote in message
news:40******** *******@agricor eunited.com... In Internet Explorer, once you set disabled = true on a button, you have
no control over the text color. IE "greys" the text out (Opera 7.52 appears
to do this as well).
Your code works in Gecko-based browsers: Netscape 7, Firefox, Mozilla,
Camino, etc.
AFN wrote:
IE6
Here's the code:
<input type="submit" name="btnSubmit " value="Next" id="btnSubmit" onclick="this.v alue = 'Please wait...';this.d isabled = true;this.style .color='Green'; this.style.back ground='Red'"
style="color:Wh ite;background-color:#336699;f ont-weight:bold;wid th:150px;" />
"kaeli" <ti******@NOSPA M.comcast.net> wrote in message news:MP******** *************** *@nntp.lucent.c om... In article <Oz************ ******@twister. socal.rr.com>, DE************* ***********@yah oo.com enlightened us with... > I'm trying to set a submit button to change text and color when
clicked. > Like saying "please wait" instead of "submit" and then changing the > background color and text color. All works, except for changing
the text > color. > > I can set style.backgroun d='red' to change the background color to
red. > But if I say style.color='gr een' to change the text color, it does
not > change. How do you change the text color on a button when it is clicked? >
Funny, it worked fine for me in IE6 and NN7.2. What browser are you trying to get it to work in? It won't work in all browsers, though it should work in all that support the element.style property AFAIK.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <head> <title> New Document </title> <script type="text/javascript" language="javas cript"> function changeBtn(btn) { if (! btn.style) { alert("Sorry, your browser doesn't support this operation."); return; } btn.style.backg round = "red"; btn.style.color = "blue"; return; } </script> </head>
<body> <form id="f1" name="f1" action="" method=""> <br> <input type="button" value="Try me" onClick="change Btn(this)"> </form> </body> </html>
-- Grant Wagner <gw*****@agrico reunited.com> comp.lang.javas cript FAQ - http://jibbering.com/faq
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Matt Adams |
last post by:
As well known I could specify the text color in the body tag like:
<BODY TEXT=WHITE LINK=WHITE VLINK=RED ALINK=WHITE>
What I want to achieve now is that always (!) the text of the last visited link and
the text of the link under the cursor are red. All other links should be white.
The problem with the construction above is that a visited...
|
by: liglin |
last post by:
The following script changes the color of text with the onmousover
event. How can it be modified so it changes the text when the button
is clicked? I'd want to avoid layers or CSS.
Thanks, Liglin
<HTML>
<HEAD>
<TITLE>Untitled Document</TITLE>
|
by: Yeah |
last post by:
I have a multiple choice quiz where I would like to use CSS to change the
color of the answers upon clicking them. I would like to present the right
and wrong answers up front, rather than direct the user to a separate page
with all correct answers.
Do the answers have to be "links" for this to work? They have to be inactive
links, because...
|
by: Yeah |
last post by:
I have a multiple choice quiz where I would like to use CSS to change the
color of the answers upon clicking them. I would like to present the right
and wrong answers up front, rather than direct the user to a separate page
with all correct answers.
Do the answers have to be "links" for this to work? They have to be inactive
links, because...
|
by: |
last post by:
hi,
selected items in check box disappears when submit button is clicked on aspx
page. check box is pasted on .ascx page and which is pasted on aspx page
any ideals
cheers
sam
| |
by: Olivier Verdin |
last post by:
Hi,
I am developing a multi-language application in ASP.NET in c#.
I am using a file field html control to upload an image.
I would like to change the text on the button "browse" that comes with the
control. I need to change the text to have the correct text for the
language chosen.
|
by: ramkishor |
last post by:
How can I change the color of button on mouse move over it.
help .
|
by: JWest46088 |
last post by:
I am working in Dreamweaver CS4 and have a contact form. I am using PHP to send the info. I have a disabled textbox that I want to use to display whether the contact form was sent successfully or failed. How would I send a success or failure message to this disabled textbox after the submit button is clicked? Thanks in advance!
|
by: Ellyyra |
last post by:
I am trying to make a 'Character Generator' for a website.
In the first page they are asked for three pieces of information each with a group of radio buttons; Gender-Male, Female; HairColour-Black, Blonde, Brown, Grey, Orange, White; ClothingColour- Red, Yellow, Pink, Green, Purple, Orange, Blue.
Once they have selected an option and click...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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...
| |