[Javascript] Re: Getting frame height and width

Rodney Myers rodney at aflyingstart.net
Fri Jun 15 03:53:25 CDT 2001


<html><head><title>Form Document</title>
<script language="JavaScript">

function sizeTextArea(){
var winWidth=top.document.all.mainFrame.width;
var winHeight=top.document.all.mainFrame.height;
// offsets of 20 and 40 prevented scrollbars appearing on window
document.myForm.textvar.style.width=winWidth-20;
document.myForm.textvar.style.height=winHeight-40;
}

</script>
</head>
<body onload="sizeTextArea();">
<form name="myForm" method="post" action="">
<textarea cols="70" rows="25" name="textvar" id="textvar" wrap="off">
</form> </body> </html>

phumes1 at home.com wrote:

> I have in previous emails. I have attached a screen capture of my template.
> It is done with frames.
> Notice the file being pulled in (Frame B). This window is done with a
> <TEXTAREA>...</TEXTAREA> tags.
>
> The code for the textarea is as follows:
>
> <textarea cols="70" rows="25" name="textvar" id="textvar" wrap="off">
>
> What I want to do is using Javascript (or anything) to figure out the width
> and height of frame "B" and
> pass those coordinates to the "cols" and "rows" of the <textarea> tag. So
> when the window is resized
> by the user the textarea will also resize accordingly.
>
>  From previous emails is it my understanding that the "cols" & "rows" of
> the textarea is "characters"
> and *not* pixels?
>
>   ------------------------------------
> |            Top Nav                     |
>   ------------------------------------
> |               |                                |
> |               |                                |
> |               |                                |
> |       A      |             B                |
> |               |                                |
> |               |                                |
> |               |                                |
>   ------------------------------------
> |            Bot Nav                     |
>   ------------------------------------
>

--
Shop at ssistant Add-ons and Developer Workshops
http://www.aflyingstart.net/addons/

Enquiries regarding Shop at ssistant Classic training :
Call 01256 880770

Rodney Myers
Based in Oxford, England
Technical Director, Shop at ssistant eCommerce Solutions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20010615/dbfa076c/attachment.htm>


More information about the Javascript mailing list