Solved

onmouseover image swap in different location on page

Posted on 2008-10-08
2
579 Views
Last Modified: 2012-05-05
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
Comment
Question by:katieflygirl
2 Comments
 
LVL 16

Accepted Solution

by:
sh0e earned 125 total points
ID: 22675206
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
 

Author Closing Comment

by:katieflygirl
ID: 31504515
That's what I needed.  Thank you!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Suggested Solutions

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

860 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