www.webdeveloper.com
Results 1 to 2 of 2

Thread: Resizing an iframe after using javascript history or something?

  1. #1
    Join Date
    Oct 2011
    Posts
    1

    Resizing an iframe after using javascript history or something?

    hey, can someone help me? im trying to use javascript history to resize an iframe when a submit button is clicked inside the iframe, im a newbie to javascript and i would be you grateful forever if you could help me out!

    this is what i found so far.

    Code:
    <script type='text/javascript'> 
    function checkHistory() {
    var hist=history.length;
    if (hist>1)//just change value 1 to other if you need :)
    	{
    		//redirect or resize or whatever... :P
    	}
    }
    </script>
    3)Us this with iframe:
    Code:
    Code:
    onload="checkHistory()"
    but im not really sure on how to apply this to my iframe, and i know that the resize part also needs to be edited, but what is missing? can someone help me out?

  2. #2
    Join Date
    Sep 2009
    Posts
    159
    I don't really understand what you're trying to do with History, but the code below will let you adjust the size of an iframe. (Note the one line jQuery in <script> tag.)

    Code:
    <html>
    <head>
    </head>
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function() {
    	// dimensions are in pixels
    	$("#test").height(500).width(500);
    });
    </script>
    <style>
    	iframe
    	{
    		width:100%;
    		height:100%;
    		border:1px solid;
    	}
    </style>
    <body>
    <div id="test">
    	<iframe src="http://www.faithandpromise.com"></iframe>
    </div>
    </body>
    </html>
    Got jQuery problem? jQuery vault can help you find solutions. Give it a try and find out.

    Click jQuery vault to help us help you.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles