Click to See Complete Forum and Search --> : div boxes, frames and mouseovers...
I have got a set of links in one frame and when my mouse moves over it I want text displayed in another frame on the same page. I didn't want to have a messy-looking textarea and so I thought I might be able to do it with a div box using the visibility: command in the style section. I can't work out what to do to show the box again using mouseover though. Can anyone help? If there are any simpler ways (which there undoubtedly are) could someone give me one of those. Its probably easier to reload the frame, but it has graphichs on it to and I don't want the load time to be too long. Sorry, a bit long winded.
Thanks,
IxxI
gil davis
02-05-2003, 09:47 AM
To access the visibility of an object in another frame, use:
window.top.otherFrameName.document.getElementById(idOfTheObjectYouWant).style.visibility
where otherFrameName is the name of the other frame, and idOfTheObjectYouWant is the id of the object (a string literal).
Thank you for your quick response but I've tried it and it doesn't seem to work. Here's the code in the links frame:
<script>
function showbox() {
window.top.main.document.getElementById(mainbox).style.visibility: visible;
}
</script>
</HEAD>
<BODY topmargin="4" leftmargin="20" BGCOLOR="#C0C0C0" TEXT="#0F0000" ALINK="#0F0000" VLINK="#0F0000" LINK="#000000">
<font face="times new roman" size="5">
<CENTER>
<A HREF="page1.html" target="main" onMouseover="showbox()">Page 1</A>
and here's the code in my main frame (which has name="main"):
<style type="text/css">
.boxes{
padding: 10px;
}
#mainbox{
visibility: hidden;
}
</style>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" ALINK="#006600" VLINK="#0000CC" LINK="#00FFFF" topmargin=10 leftmargin=10>
<BR><BR>
<font face="arial">
<CENTER>
<div class="boxes" id="mainbox">
This is what I want to appear when my mouse moves over the links in the other frame
</div>
</CENTER>
Its probably something simple or something I've misunderstood. I appreciate the help.
IxxI
khalidali63
02-05-2003, 10:19 AM
Originally posted by IxxI
<script>
function showbox() {
window.top.main.document.getElementById(mainbox).style.visibility: visible;
}
</script>
IxxI
main.document.getElementById(mainbox).style.visibility:
should be like this
main.document.getElementById("mainbox").style.visibility="visible";
gil davis
02-05-2003, 10:26 AM
Originally posted by IxxI
window.top.main.document.getElementById(mainbox).style.visibility: visible;should be
window.top.main.document.getElementById("mainbox").style.visibility = "visible";
Thank you both very much. It now works fine.
IxxI
I've now shoved those frames into an iframe and centred it (so that it works on smaller resolutions) and it now doesn't work again. Any suggestions?? Is it anything to do with the window.top bit? The frame names haven't changed they're now just nested in an iframe.
Thanks,
IxxI