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

onmouseover image swap in different location on page

I have a script that has an onmousemover effect that displays the image in a different location in the same page.  I would like this to be another image, rather than the one that I just rolled over.  
<script type="text/javascript">
function showIt(imgsrc)
{
document.getElementById('imageshow').src=imgsrc;
}
 
function hideIt()
{
document.getElementById('imageshow').src="aliceyoga.jpg";
}
</script>
 
<body>
<img src="images/step1.jpg" onmouseover="showIt(this.src)" onmouseout="hideIt()"><br>
<img src="images/STEP2.jpg" onmouseover="showIt(this.src)" onmouseout="hideIt()">
</body>

Open in new window

0
katieflygirl
Asked:
katieflygirl
1 Solution
 
sh0eCommented:
Need more information.

If you want it to show different images, you need to call showIt() with a different image name.
Such as onmouseover="showIt('path/to/image.jpg')"
<script type="text/javascript">
function showIt(imgsrc)
{
document.getElementById('imageshow').src=imgsrc;
}
 
function hideIt()
{
document.getElementById('imageshow').src="aliceyoga.jpg";
}
</script>
 
<body>
<img src="images/step1.jpg" onmouseover="showIt(this.src)" onmouseout="hideIt()"><br>
<img src="images/STEP2.jpg" onmouseover="showIt(this.src)" onmouseout="hideIt()">
</body>
 
<img id="imageshow"/>

Open in new window

0
 
katieflygirlAuthor Commented:
That's what I needed.  Thank you!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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