...

View Full Version : JavaScript and Frame use...



Wolf_22
06-01-2005, 09:50 PM
Okay, heres the code:




<script language ="javascript">
<!--

onload=parent.child.upper.body.setAttribute("rows","5,*");

//-->
</script>



Now, I have 2 frames, and I'm trying to make the frameDefinition page resize the header frame or "upper" frame on an onload event. I keep getting errors though when I use the above code inside the head tag of the frameDefition page. Are you not allowed to use JavaScript inside the head tag in a frameDef page??? What am I doing wrong???

Thanks

Mr J
06-01-2005, 11:05 PM
Yes you can use scripts in the head section of the frame definition page but why change the frame size with a script when you can easily do it in the definitions which are in the same page?

Having said that if the following is placed at the end of the definitions page it will resize the frame

<script>
onload=document.body.rows="15,*"
</script>

To do the same from another frame the following can be put in the head section of a page loaded into that frame

<script>
onload=parent.document.body.rows="15,*"
</script>

I only found this to work in IE and not gecko browsers

glenngv
06-02-2005, 02:40 AM
I only found this to work in IE and not gecko browsers
Try this:


parent.document.getElementById("framesetId").setAttribute("rows", "15,*");

Mr J
06-02-2005, 01:56 PM
Thanks for that glenngv :thumbsup:

I haven't done anything frame related in ages so wasn't really sure, might even be able to get one of my scripts to work cross browser now :D

Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum