Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Apr 2005
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    JavaScript and Frame use...

    Okay, heres the code:

    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

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    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
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Quote Originally Posted by Mr J
    I only found this to work in IE and not gecko browsers
    Try this:

    Code:
    parent.document.getElementById("framesetId").setAttribute("rows", "15,*");
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Thanks for that glenngv

    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

    Thanks
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •