Text rollover please! :)

They have: 2,390 posts

Joined: Nov 1998

Hi folks,
I need aquick script by tonight if pos or whenever anyone reads this...

I would like the following:

» <a href="link">text</a>

[the link is a rollover with CSS and I want the » to become red as the mouse passes over the text]
Could anyone to do this?
cheers,
JP

PS: it does not have to be Netscape copm.

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

Well, since NS compatibility isn't needed, here you go. Adjust the color names to your liking.

<HTML>
<HEAD>
<SCRIPT language="JavaScript">
<!--
function change_it(span_id,the_color)
{
var insert_span_id= eval("document.all."+span_id);
insert_span_id.style.color=the_color;
}
//-->
</SCRIPT>

</HEAD>

<BODY>
<P>
<SPAN ID="first" style="color:black">»</SPAN> <a href="link" onMouseover="change_it('first','red');" onMouseout="change_it('first','black');">text</a>
<P>
<SPAN ID="second" style="color:black">»</SPAN> <a href="link" onMouseover="change_it('second','red');" onMouseout="change_it('second','black');">text</a>
<P>
John is awesome.
</BODY>
</HTML>

The last part of the body section is optional, of course. Ha!

They have: 5,633 posts

Joined: Jan 1970

I just wish there was an easy way to do the same thing in Netscape. I am having a hard time at the moment getting layers to work in both IE & NN. I think I need to go out and buy a good Dhtml book. Any suggestions?

------------------
http://go.to/hass

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

I'm with you on that one. But until NS recognizes certain things as objects, it probably just can't do what we want it to. If anyone does know a good book, do post it-- I'm sure both of us would like to read it.

They have: 359 posts

Joined: Mar 1999

John,

You were referring to John Stones, weren't you?

Dan

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

Well, yes... of course I was..LOL

They have: 2,390 posts

Joined: Nov 1998

cheers John, all - much apreciated.
JP

They have: 2,390 posts

Joined: Nov 1998

ah, came across a problem:
When I use:

Code Sample:

&lt;P&gt;&lt;span id="first" style="color:black"&gt;&lt;b&gt;»&lt;/b&gt;&lt;/span&gt; &lt;a href="link" onMouseOver="change_it('first','red');" onMouseOut="change_it('first','black');"&gt;Bulletin Boards &lt;/A&gt; &lt;/p&gt;

...all works fine, but when I use:

Code Sample:

&lt;P&gt;&lt;span id="first" style="color:black"&gt;&lt;b&gt;»&lt;/b&gt;&lt;/span&gt; &lt;a href="link" onMouseOver="change_it('first','red');" onMouseOut="change_it('first','black');"&gt;Bulletin Boards &lt;/A&gt; &lt;BR&gt;
                       &lt;span id="first" style="color:black"&gt;&lt;b&gt;»&lt;/b&gt;&lt;/span&gt; &lt;A HREF="link" onMouseOver="change_it('first','red');" onMouseOut="change_it('first','black');"&gt;Affiliate Programs&lt;/A&gt;&lt;BR&gt;
                       &lt;span id="first" style="color:black"&gt;&lt;b&gt;»&lt;/b&gt;&lt;/span&gt; &lt;A HREF="link" onMouseOver="change_it('first','red');" onMouseOut="change_it('first','black');"&gt;Website Hosting&lt;/A&gt;&lt;BR&gt;
                       &lt;b&gt;»&lt;/b&gt; Free Newsletters &lt;BR&gt;
                       &lt;span id="first" style="color:black"&gt;&lt;b&gt;»&lt;/b&gt;&lt;/span&gt; &lt;A HREF="link" onMouseOver="change_it('first','red');" onMouseOut="change_it('first','black');"&gt;Web Based Email&lt;/A&gt;&lt;/P&gt;

...nothing works! Anyone got an explanation?
cheers,
JP

PS: It might be simple as I have just come back from 16 hours at work

They have: 5,633 posts

Joined: Jan 1970

You can't use the same id="NAME" for each span.

------------------
http://go.to/hass

They have: 5,633 posts

Joined: Jan 1970

I don't know if that is what you want but here you go anyway. Put that in the <head></head> tags. Also change the colors to what you want. What this script does is have non-underlined text change over to a different color when a mouse moves over it. Also you don't need any special stuff in the link code just put in a normal link code and this should work.
<style><!--
A:link {text-decoration: none; font-family: arial; color: red}
A:visited {text-decoration: none; font-family: arial; color: red}
A:hover {text-decoration: none; font-family: arial; color: yellow}
-->
</style>

Your welcome,
~Park~

------------------
ICQ-54455232
E-mail- [email protected]
http://photolink.hypermart.net/pstuff2/

They have: 2,390 posts

Joined: Nov 1998

thanks all, sorry for wasting your time with a silly question
JP

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.