Solved

I need to change the color of a label

Posted on 2008-10-19
4
145 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now