Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rollover - 2 images different spots

Status
Not open for further replies.

wicked

Technical User
Oct 24, 2000
1
US
Does anyone have a script that can create rollovers that work in two different spots? I.E. say you had a table with one row and two cells, and you want the image in the first cell to change the image in the second cell, rather than just swapping the first image. Not sure what this is called but I can't find a script for this anywhere, any help would really be appreciated! [sig][/sig]
 
Pretty simple. Try the example below. It doesn't take into account things like pre-caching images or using eval statements to do a whole lot of images/mouseovers...
Code:
<html>
<head>
<style type=&quot;text/css&quot;>
 .over{cursor:&quot;hand&quot;}
</style>
<script language=&quot;javascript&quot;>
 function fnMOver(){
  document.images.img1.src = &quot;image2.gif&quot;
  document.images.img2.src = &quot;image1.gif&quot;
 }
 function fnMOut(){
  document.images.img1.src = &quot;image1.gif&quot;
  document.images.img2.src = &quot;image2.gif&quot;
 }
</script>
<body>
 <h1 class=&quot;out&quot; onMouseOver=&quot;this.className='over';fnMOver()&quot; onMouseOut=&quot;fnMOut()&quot; id=hDemo>Mouse over me</h1><br>
 <img src=&quot;image1.gif&quot; id=img1><img src=&quot;image2.gif&quot; id=img2>
</body>
</html>

Later,

Rob
robschultz@yahoo.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

&quot;Focus on the solution to the problem,

not the obstacles in the way.&quot;

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top