473,883 Members | 1,605 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Return button Style to Default

I am using some buttons to hide/show various divs and am changing the style of
the button to indicate which button's view is "active".

My problem is that for the non-active buttons I want the default look. Once I
change a button's style to something else what is the style setting to revert
them back to this default?

EX:
Button starts at default.

Upon press set different background
document.getEle mentById("btnNa me").style.back ground = "someColor"

What command changes it back? I've tried "" and that seems to work (you guessed
it) in FF, but not in IE. I also tried ThreeDFace with the same effect (good in
FF, bad in IE).

TIA

Mar 6 '06 #1
3 3593
Rick Brandt wrote:
I am using some buttons to hide/show various divs and am changing the style of
the button to indicate which button's view is "active".

My problem is that for the non-active buttons I want the default look. Once I
change a button's style to something else what is the style setting to revert
them back to this default?

EX:
Button starts at default.

Upon press set different background
document.getEle mentById("btnNa me").style.back ground = "someColor"
Changing the style object's *backgroundColo r* property between 'red' and
'' seems to work fine for me in IE 6.

<button id="btn"
onclick="alert( this.style.back groundColor);"> button</button>
<button
onclick="docume nt.getElementBy Id('btn').style .backgroundColo r = 'red';"Make it red</button> <button
onclick="docume nt.getElementBy Id('btn').style .backgroundColo r = '';"Revert to default</button>



This is more a CSS question, it may be better answered in
news:comp.infos ystems.www.authoring.stylesheets

--
Rob
Mar 6 '06 #2
"RobG" <rg***@iinet.ne t.au> wrote in message
news:_Y******** *********@news. optus.net.au...
Rick Brandt wrote:
I am using some buttons to hide/show various divs and am changing the style
of the button to indicate which button's view is "active".

My problem is that for the non-active buttons I want the default look. Once
I change a button's style to something else what is the style setting to
revert them back to this default?

EX:
Button starts at default.

Upon press set different background
document.getEle mentById("btnNa me").style.back ground = "someColor"
Changing the style object's *backgroundColo r* property between 'red' and ''
seems to work fine for me in IE 6.

<button id="btn"
onclick="alert( this.style.back groundColor);"> button</button>
<button
onclick="docume nt.getElementBy Id('btn').style .backgroundColo r = 'red';"
>Make it red</button>

<button
onclick="docume nt.getElementBy Id('btn').style .backgroundColo r = '';"
>Revert to default</button>


Thanks, I'll check recheck, but I could have sworn that when I first tried
backgroundColor I got errors. Maybe I had the case wrong? Does the case have
to be just as you have it?
This is more a CSS question, it may be better answered in
news:comp.infos ystems.www.authoring.stylesheets


Yeah, but since it was about setting the style in js I figured they would just
send me here : )

Thanks again.

Mar 6 '06 #3
Rick Brandt wrote:
"RobG" <rg***@iinet.ne t.au> wrote in message
news:_Y******** *********@news. optus.net.au... [...]
Thanks, I'll check recheck, but I could have sworn that when I first tried
backgroundColor I got errors. Maybe I had the case wrong? Does the case have
to be just as you have it?


Yes. HTML isn't case sensitive (in general) but JavaScript is.

This is more a CSS question, it may be better answered in
news:comp.inf osystems.www.authoring.stylesheets

Yeah, but since it was about setting the style in js I figured they would just
send me here : )


Your issue actually is with JavaScript, but there you may have received
more (authoritative) information about using styles with buttons (or
not...). :-)
--
Rob
Mar 6 '06 #4

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

Similar topics

1
2598
by: Paul Gobée | last post by:
What is the parent element of a button (IE6 on Win, transitional mode)? Is it the BODY, the browser default stylesheet, or something else? Contra "body is parent-element": - Buttons with no style specified have a different font-size than the body's font-size. - If I change the body's font-size, a button with no style specified remains at the same font-size
6
6901
by: Marek Mänd | last post by:
Can the <button><img></button> mutated via CSS so, that the inner image of <BUTTON> would entirely visually become the button itsself - I mean without the outer elements borders and so... I tried removing paddings and borders and margins but this wouldnt seem to help. in MSIE, Mozilla and Opera - there still some pieces of the
38
2067
by: looping | last post by:
For Python developers around. >From Python 2.5 doc: The list of base classes in a class definition can now be empty. As an example, this is now legal: class C(): pass nice but why this syntax return old-style class, same as "class C:", and not the new style "class C(object):" ?
6
13784
by: rongchaua | last post by:
Hi all, I want to change the style of a button. But I don't know how to do it. For example, I have already a button OK on form. I want to add these styles to this button (WS_CHILD || WS_VISIBLE || WS_CLIPSIBLINGS || WS_TABSTOP || BS_FLAT). What should I do now? All help will be appreciated. rca.
18
5818
by: Axel Dahmen | last post by:
Hi, trying to submit an ASPX form using the key (using IE6) the page is not submitted in my web project. Trying to debug the pages' JavaScript code I noticed that there's some ASP.NET client script code being executed having a flaw: function anonymous() { if (!ValidatedTextBoxOnKeyPress(event)) { event.cancelBubble = true; if (event.stopPropagation) event.stopPropagation(); return false; } }
2
3092
by: thuythu | last post by:
Please help me.... I used and Javascript to view the data. But when i click button open a popup windows, then select data and click save button. The popup close and return the main page, but the textbox value in the main page is undefined ---------------------------------------- here are code main page: ------------------------------------------- <script language="JavaScript"> var thedata; var newwin; var thenumber; function...
7
1301
by: =?Utf-8?B?QW50?= | last post by:
Hi, If I place a button on either a Web form or an HTML form, when I run the page in a browser, the button stretches right across the screen. This happens with our Enterprise Visual Studio at work & the Web developer Express edition I have at home. Has anybody experienced this problem? Many thanks for any ideas on how to fix it.
1
2302
by: Sudarhan | last post by:
Hello frnds I have created a webbased form using asp and javascript .. while submitting the form i am validating the fields in the form .it validates the field and returns alert message. but when user clicks on alert box it submits the form instead of focusing to desired field... I have cascade style webform .so if havent filled field in 2nd sheet and i click on submit button in 4 sheet.. it prompts the alert box but does not focus to 2nd...
2
2589
by: =?Utf-8?B?ZWdzZGFy?= | last post by:
Hello, i have implemented a button in some other pages that calls another one, the problem is that everytime I hit the button he goes for the postback code and I already disable that part. this is my code: <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" Title="SIP :: Nichos de Mercado" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.OleDb" %> <script runat="server">
0
9793
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10750
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...
1
10858
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10419
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...
0
9577
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7974
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
7134
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();...
1
4619
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
2
4225
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.