Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

onmouseover image swap in different location on page

Posted on 2008-10-08
2
Medium Priority
?
603 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
sh0e earned 500 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

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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?
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
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…

636 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