Solved

onmouseover image swap in different location on page

Posted on 2008-10-08
2
589 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 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…

705 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