Solved

I need to change the color of a label

Posted on 2008-10-19
4
147 Views
Last Modified: 2012-05-05
I am using the following code to hide then show text, and I have both "Read More" and "Read Less" tags to help the user navigate.  But I find it difficult to differentiate them.

Can someone show me how to make them have different colors??

Thanks,
newbieweb

<a href="#" onclick="var block=document.getElementById('FullTextPaymentTerms');
this.innerHTML=(block.style.display=='none')?'... Read Less':'... Read More';
block.style.display=(block.style.display=='none')?'':'none';return false;">... Read More</a></FONT></P>

0
Comment
Question by:newbieweb
  • 3
4 Comments
 
LVL 10

Expert Comment

by:Phatzer
ID: 22753122
This should work...
<style type="text/css">
.readmore { color: red; }
.readless { color: blue; }
</style>
 
<a href="#" onclick="var block=document.getElementById('FullTextPaymentTerms');
this.innerHTML=(block.style.display=='none')?'<span class=\'readless\'>... Read Less</span>':'<span class=\'readmore\'>... Read More</span>';
block.style.display=(block.style.display=='none')?'':'none';return false;"><span class=\'readmore\'>... Read More</a></FONT></P>

Open in new window

0
 
LVL 10

Expert Comment

by:Phatzer
ID: 22753144
Sorry, this should be better:

<a href="#" onclick="var block=document.getElementById('FullTextPaymentTerms');
this.innerHTML=(block.style.display=='none')?'<span class=\'readless\'>... Read Less</span>':'<span class=\'readmore\'>... Read More</span>';
block.style.display=(block.style.display=='none')?'':'none';return false;"><span class="readmore">... Read More</a></FONT></P>

Tell me how that goes.
0
 

Author Comment

by:newbieweb
ID: 22753149
I forgot to tell you.  This is for an eBay ad and they do not give me access to the header of the HTML file, just the body.

Could you do this in-line?

thanks,
newbieweb
0
 
LVL 10

Accepted Solution

by:
Phatzer earned 500 total points
ID: 22753155
Sure you can, means you'll need to change the CSS for '... Read more' twice though.

<a href="#" onclick="var block=document.getElementById('FullTextPaymentTerms');
this.innerHTML=(block.style.display=='none')?'<span style=\'color: red;\'>... Read Less</span>':'<span style=\'color: blue;\'>... Read More</span>';
block.style.display=(block.style.display=='none')?'':'none';return false;"><span style="color: blue;">... Read More<span></a></FONT></P>
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Objects on Same Line 2 30
Link a VBS to an HTA 6 37
Browser Chrome downloads colored link 5 41
Hide cell in a table 2 14
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question