I need help knowing what's wrong with this code.

  • Thread starter Thread starter paul
  • Start date Start date
P

paul

HI! I am trying to get a variable value from a script in an iframe page. the
value that I am trying to get is "y" for the height attribute but I don't
know what I am doing in the code below. I don't get an error in IE but the
value does not get displayed or any value even the default.
Can someone tell me?


<script language="JavaScript">
<!--
var varborderfromiframe=1;
window.varborderfromiframe=window.Iframemain.y;
document.write(varborderfromiframe)
//-->
</script>

Paul
 
Well lets see.

1. What type of event are you using to "fire" the script??
I don't see any designated function in your script. You need to fire a
function somehow

2. Don't declare a variable and assign it a value at the same time.
Declare the variable:
var varborderfromiframe
and then assign it a value
varborderfromiframe = 1;

3. iframe width and height are not expressed as x and y, but are width and
height
x and y apply to distance from the upper left corner of a window.

4. document.write where?? You need to specify an element in the page for
document.write to write too.

So,

<script type="text/javascript">
<!--
var varborderfromiframe
function DoSomething(){
varborderfromiframe = 1; // why are we giving the variable a value here,
when were getting it from the iframe in the next line
varborderfromiframe = window.Iframemain.height; // Providing the name of
the iframe is iframemain

//What are you trying to do with the next line??

document.write.SomeElementToWriteTo(varborderfromiframe);
}
//-->
</script>


Kind of hard to be more specific without knowing what you're trying to do.!!

--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
HI! thanks Steve, I am trying to expand a middle cell to be the size - some
pixels in order to make a graphics on a page to be aligned.

Take a look here. http://www.ajmusicmedia.com

The top left and bottom blue image is suppose to be flush with the top and
bottom respectively. So I need to figure out a way to expand the middle cell
to make it all fit. I figure perhaps I can use a transparent gif/png and set
its size to the height - some pixels to the height of the iframe page. Also
note that the iframe page has variable content and scales to fit its
content. I use a script to this.

At the bottom of this page I have included the auto resizing script for the
iframe and it works great in all browsers.

So I just need a way to expand that middle cell. do you have a better
suggestion or approach?


----------------Auto Iframe Resizing Script-------------------
<script language="JavaScript">
<!--
var origheight = 0;
function autoResize(id){
var newheight;
if (!window.opera && !document.mimeType && document.all &&
document.getElementById)
newheight=document.getElementById(id).contentWindow.document.body.offsetHeight;
else if(document.getElementById)
newheight=document.getElementById(id).contentWindow.document.body.scrollHeight;
document.getElementById(id).height= (newheight + 0) + "px";
if
(document.getElementById(id).contentWindow.location.href.indexOf("index_test.html")>0
&& origheight>0)
document.body.style.height = origheight;
}
//-->
</script>
----------------End of Auto Iframe resizing script-------------------

This is how I call the function in the Iframe tag.

<iframe src="Without_FL/iframes/main_iframe.html" id="Iframemain"
name="Iframemain" height="560" width="492" scrolling="no" frameborder="0"
marginwidth="0" marginheight="0" onLoad="autoResize('Iframemain');">some
text</iframe>

----------------

One last thing is that I use another menu script that uses a body unload
event handler so it was needed to add this into its code to the onload
section.

origheight = document.body.clientHeight;
 
HI! after looking at it for a while I decided to get my mind off it and then
it came to me. I was going about it the wrong way. the answer was so simple
after all.

Solution: All I had to do was take all three vertical cells and use CSS to
make the background the same as the middle cell and repeat the Y coordinate.
then I insert the Top image and make the cell align top and insert the
bottom to align bottom. So as the cells expand due to iframe on the right
being resized according to its content, the left side appears to expand only
in the middle when actually the top cell is expanding as well but since
there is a background image identical to the middle image it appears that
only the middle cell is expanding.

Anyways I want to thank you for responding to my post. I hope this post
helps someone else :)

Paul
 
Glad you figured it out.

Sorry I didn't reply earlier, but we had friends over for a little party to
watch the Jags, New England game.

--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
Back
Top