I’m trying to set up a page where there will be several titles in a row, with a descriptive paragraph below. When the user scrolls over the titles, the paragraph will change corresponding to the title they are hovering over. I would like each title to be a different color, and the font color of the paragraph should change to match the title’s color. The problem I’m having is getting the paragraph’s color to change.
Here’s my example:
<script type="text/javascript">
function onover(caption)
{document.getElementById('text').innerHTML=caption;}
{document.getElementById('text2').innerHTML=caption;}
</script>
<a onmouseover="onover('Paragraph 1')" style="color:green">Title 1</a>
<a onmouseover="onover('Paragraph 2')" style="color:red">Title 2</a>
</br>
<div id="text" style="color:green">Paragraph 1</div>
<div id="text2" style="color:red"></div>
Updated Since OP wanted to replace the text,
Demo
Update 2