Forum Moderators: open

Message Too Old, No Replies

inline frame z-index

changing the z-index of a target inline frame on click

         

J_Man

1:33 am on May 20, 2004 (gmt 0)

10+ Year Member



I want to change the z-index of an inline frame (containing a menu) when a button is clicked in another frame. I'm going to have one master frame behind all. A second frame (containing the button) will be above the master frame. A third inline frame will be bellow the button. When the button is clicked I want to change the z-index of the menu frame to -1. And when clicked again bring the z-index back to 2. I think the best way is an onload function in the button frame and link to another page when clicked that does the inverse function. I'm bad at scripting so if someone could show me how to do this I'd appreciate it.

Rambo Tribble

4:30 am on May 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



From what you describe, it sounds like you would be better advised to use either the visibility property or the display property to hide/reveal your iframe. Here's an example (the iframe's background:white; rule is to get a consistent result between IE and Moz):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Swap visibility 05-19-04</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
var statVar="v";
function swapV(elemID){
if(statVar=="v"){
var d=document.getElementById(elemID);
d.style.visibility="hidden";
statVar="h";
}else{
var d=document.getElementById(elemID);
d.style.visibility="visible";
statVar="v";
}
}
</script>
</head>
<body>
<a href="javascript:swapV('if_one');">swap</a>
<div id="main_div" style="background:blue;height:300px;">
<iframe id="if_one" style="background:white;"></iframe>
</div>
</body>
</html>

J_Man

3:37 am on May 21, 2004 (gmt 0)

10+ Year Member



thank you very much

J_Man

4:38 am on May 21, 2004 (gmt 0)

10+ Year Member



woops, I think I need something else.
I need a dynamic height frame for the content, and I don't think iframes can do this. I was thinking if there were code to resize a left frame from a top frame, that would be much better. Is ther dynamic height for iframe, or will I need the resize method?

DrDoc

4:49 am on May 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can use percentage height. Otherwise, you will need to resize the iframe...

Rambo Tribble

5:11 am on May 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



DrDoc's recommendation is well merited, though you may wish to investigate ems as an alternative to percentages; they sometimes scale better, particularly if the user adjusts their text size and you want the whole display to scale accordingly.

J_Man

4:56 am on May 22, 2004 (gmt 0)

10+ Year Member



how can I resize a regular frame with a script. It'd be 3 frames, the top would control the left (making it too small to see or normal size) and the right would be the content.