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.
LVL 1
mediagirlAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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 Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.