• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

Add effect to Text in a Table Cell?

Hello all, I have an urgent one here and need a quick answer.
Hope you can help.

I need the ability to add a dim/brighten cycle or color cycle effect to text in a single table cell.

The closest I've seen is how mouse hover can change the apperance of text from one state to another, but it isn't what I'm looking for.
This needs to work without interaction from the user.

As the text in the cell (or the cell itself) will change, I need to be able to do this on the fly as well.

The only other thing I can think of right now is a cludge of converting the text to an animated .gif.
If that's the only answer, then how can that process be quick and automated?

I've just started on coding the page and will try to adapt to however it needs to be done.

This is a Fedora Core 3 server with Apache, Perl, Perl Mod, PHP, Javascript, and can add more if need be.

Thanks
0
scottzz
Asked:
scottzz
  • 2
1 Solution
 
COBOLdinosaurCommented:
The text color aor any other style elemnt of the cell cna be modified by any event anywhere on the page.  do the cell this way:

<td id="thecell" style="color:blue">
content
</td>

then off any event all you need to change the color is:
document.getElementById('thecell').style.color='red';

IF you want the change to be on a regular basis set it on a timer with a function; and start it at the load:

<body onload="changeColor(document.getElementById('thecell')">

The function will look like:

function changeColor(EL)
{
   EL.style.color=(EL.style.color=='red') ? 'blue' : 'red';
   setTimeout'(changeColor(document.getElementById("thecell")',3000);
}

if you want it to change based on content then test the content in the function:

function changeColor(EL)
{
   if (EL.innerHTML=x) EL.style.color=='red';
   if (EL.innerHTML=y) EL.style.color=='blue';
   if (EL.innerHTML=z) EL.style.color=='black';
}

However if you are changing the style properties based on dynaic content, I don't know why you would not just modify the style in the same function as you use to load the content.

Cd&
0
 
scottzzAuthor Commented:


Thanks,

Is there a way to make the color transition from one to another smooth?

i.e. fade from one color to another?


0
 
COBOLdinosaurCommented:
I've got something I do with background color on one of my article pages:

http://cd-articles.fateback.com/CSSrollovers.html#here2

Just click the link to see the effct.  The code for it is in a textarea right below the effect.

However you are going for an effect that makde a page look quite unprofessional and childish, and it will annoy most users and impress none.

Cd&
0
 
DearNeelCommented:
i've Something more, where u will not have to write so much of code if your webiste is being accessed by only  IE browsers.

Have a look at here

<a href='http://msdn.microsoft.com/library/default.asp?url=/workshop/author/behaviors/overview/transition_ovw.asp'>http://msdn.microsoft.com/library/default.asp?url=/workshop/author/behaviors/overview/transition_ovw.asp
</a>

Neel
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now