Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]How to Change Background Color on Selected Button

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]How to Change Background Color on Selected Button
 Login/Join
 
Member
posted
I am working on a HTML page and I have multiple buttons at the top. I have some good animation working when one is selected, however I am trying to also get it to change the background color of the button when it is clicked on as well.

This way the user knows which button they have selected when filling out the form.

Any suggestions?

Thanks,
Kristi Carter

This message has been edited. Last edited by: <Emily McAllister>,


WebFocus, App Studio 8.0.09
 
Posts: 21 | Registered: June 05, 2015Report This Post
Expert
posted Hide Post
I would suggest adding a js click event and change the colour or the class.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Member
posted Hide Post
I tried going down that route but couldn't figure out the actual code to make the color change. Any chance you could provide a sample?

Thanks,
Kristi Carter


WebFocus, App Studio 8.0.09
 
Posts: 21 | Registered: June 05, 2015Report This Post
Expert
posted Hide Post
Do you have the click event ?

You will need to get the control first.

You could use document.getElementById or jquery or IbComposer_getComponentById

It is just a simple case of changing the colour directly or with the class.

Many examples out there, just google it


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Gold member
posted Hide Post
Here is an example of code that I am using. On my page I have 5 date range buttons - daily, weekly, monthly, quarterly, year-to-date. You'll need to create a "Requests/Actions" JavaScript call for each of your buttons. The first JavaScript function name would be restoreButtonColors, and then another JavaScript function to change the color. In my example below it would be dailyBtn_onclick. You'll also need to create a new function for each of your buttons, and change the color hex values to meet your needs.

  
function restoreButtonColors() {
document.getElementById("dailyBtn").style.backgroundColor='lavender';
document.getElementById("dailyBtn").style.borderColor='lavender';
document.getElementById("dailyBtn").style.color='#4d4e53';

document.getElementById("weeklyBtn").style.backgroundColor='lavender';
document.getElementById("weeklyBtn").style.borderColor='lavender';
document.getElementById("weeklyBtn").style.color='#4d4e53';

document.getElementById("monthlyBtn").style.backgroundColor='lavender';
document.getElementById("monthlyBtn").style.borderColor='lavender';
document.getElementById("monthlyBtn").style.color='#4d4e53';

document.getElementById("quarterlyBtn").style.backgroundColor='lavender';
document.getElementById("quarterlyBtn").style.borderColor='lavender';
document.getElementById("quarterlyBtn").style.color='#4d4e53';

document.getElementById("ytdBtn").style.backgroundColor='lavender';
document.getElementById("ytdBtn").style.borderColor='lavender';
document.getElementById("ytdBtn").style.color='#4d4e53';
}

function dailyBtn_onclick() {
document.getElementById("dailyBtn").style.backgroundColor='#464e7e';
document.getElementById("dailyBtn").style.borderColor='#464e7e';
document.getElementById("dailyBtn").style.color='white';
}



Repeat for weeklyBtn_onclick, monthly, ect.


WebFOCUS 8.2.03
z/OS
 
Posts: 66 | Registered: May 20, 2013Report This Post
Member
posted Hide Post
Thanks a bunch. That worked great.


WebFocus, App Studio 8.0.09
 
Posts: 21 | Registered: June 05, 2015Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]How to Change Background Color on Selected Button

Copyright © 1996-2020 Information Builders