JavaScript

Moderators: None (Apply to moderate this forum)
Number of threads: 2061
Number of posts: 5164

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Resizing iFrame Posted by KAS on 19 Oct 2002 at 10:59 PM
Is there a way to resize an iframe. eg, u click a button and the iframe gets longer, or wider.
Report
Re: Resizing iFrame Posted by bgibby on 20 Oct 2002 at 7:46 PM
: Is there a way to resize an iframe. eg, u click a button and the iframe gets longer, or wider.
:

Hi there,

You could try using the document.getElementById method to get the IFrame and then set it's style.width and style.height to the appropriate width and height.

HTH
Bradley q:)
Report
Re: Resizing iFrame Posted by KAS on 21 Oct 2002 at 1:00 AM
I've tried what you said, but can't get it too work, do you have a script sample?
Report
Re: Resizing iFrame Posted by bgibby on 22 Oct 2002 at 6:13 AM
: I've tried what you said, but can't get it too work, do you have a script sample?
:
Hi there,

Ok here goes...


<html>
<head>

<script language="JavaScript">

function resize() {
	document.getElementById("brad").style.width = "100px";
	document.getElementById("brad").style.height = "100px";
}

</script>
</head>
<body>

This is the main window.<p>

<iframe src="test2.html" width="500px" height="200px" id="brad"></iframe><p>

<a href="javascript:resize();">Click here to resize to 100px by 100px</a>

</body>
</html>



HTH
Bradley q:)



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.