Solved

onmouseover image swap in different location on page

Posted on 2008-10-08
2
567 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
Comment Utility
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
Comment Utility
That's what I needed.  Thank you!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now