Solved

How to change the color of text elsewhere on page on rollover

Posted on 2008-06-11
1
224 Views
Last Modified: 2013-12-25
I am trying to do something on an .asp based page.  I have a line of text that, when I roll over it, I would like to have change the color of a word elsewhere on my page.  Is this hard to do?  Can someone show me how this is done?

Ideally I would like to do something like this ... http://www.siegelgale.com/expertise/ ... but I can settle for just changing the color if that is a bit too tricky.

Thanks!
0
Comment
Question by:TheShaner
1 Comment
 
LVL 8

Accepted Solution

by:
CoyotesIT earned 500 total points
ID: 21761870
You can try something like this here. You will need to be able to reference the id of the text, which i've assigned to the <span> tag of the text that changes color.

Hope this helps.



<html>

<head>
 

<script type="text/javascript">

	function changeColor(id, color) {

		document.getElementById(id).style.color = color;

	}

</script>
 

</head>
 

<body>

<p>

<span onmouseover="changeColor('changemycolor', 'red');" onmouseout="changeColor('changemycolor', 'black');">Roll over Me!</span>

</p>
 

<p>

Some filler text, Some filler text, Some filler text, Some filler text, Some filler text, Some filler text, 

</p>
 

<p>

<span id="changemycolor">Roll over that text up there to see me change color</span>

</p>
 

</body>
 

</html>

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

706 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

13 Experts available now in Live!

Get 1:1 Help Now