[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

java mouse over across frame

can/how do i add a 2-way (ie. actual moused image changes as well as an image in the frame above it) java mouse over across frameset? please answer with code if possible. thank ya.
0
mediagirl
Asked:
mediagirl
  • 3
  • 3
  • 2
1 Solution
 
TTomCommented:
Here goes:
<script>
function ld() {
      parent.myframe.document.myImage.src = "img2.jpg"
}
function unld() {
      parent.myframe.document.myImage.src = "img1.JPG"
}
</script>


<a href="" onmouseover="javascript:ld();myImg.src='img1.JPG'" onmouseout="javascript:unld();myImg.src='img2.jpg'"><img name="myImg" src='img2.jpg'></a>

This, of course, assumes that your frameset has a frame named 'myframe' which contains a document containing an image named 'myImage'.

This works in IE5 and NS4.6, but the images are not resized properly in NS.  Ergo, both images must be the same size.  That is, the pair of images which are being swapped in each document must be the same size.

Tom

0
 
binkzzCommented:
Put size tags into the img tags.

Also, try saying <img onmouseover=ld(this); onmouseout=unld(this);>

<script language=javascript>
  function Id( what )
  {
    what.src = 'img2.jpg';
  }

  function unld( what )
  {
    what.src = 'img1.JPG';
  }
</script>
0
 
binkzzCommented:
You can set the frame's onmouseover in the frame's body tag;

<body bgcolor=#FFFFFF onmouseover=ld(this); onmouseout=unld(this);>

T
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
mediagirlAuthor Commented:
But TTom, would that allow for both a mouseover on the main image being mousedover as well as a change in the upper frame on a completely different image?
0
 
TTomCommented:
The code I supplied above should do what you want.  I have tested it in IE5 and NS4.6.

I just used the same image names for 'convenience'.  You could make the code more 'generic' by specifying the file names in the function call and passing them to the function, as binkzz implies.

You should be aware that, unless your images (each pair that is being swapped out) have the same dimensions, you could run into 'resizing' problems.

Tom
0
 
mediagirlAuthor Commented:
Just for you TT :) Thanks a bunch for your help!
0
 
mediagirlAuthor Commented:
I hope you make the big bucks :)

mediagrrrrl
0
 
TTomCommented:
mg:

Wish I did.  Just like to help.

Thanks!

Tom
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now