Solved

I need to change the color of a label

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
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…

830 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