Solved

onmouseover image swap in different location on page

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sending E-mail ASP.Net 3 56
Debugging step-by-step Jquery/Javascript 6 57
jQuery AJAX Redirects Without Response/Error 10 45
how can i remove string values 2 7
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

912 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

25 Experts available now in Live!

Get 1:1 Help Now