Solved

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

Posted on 2008-06-11
1
227 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

808 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