Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Would this work? (Here's a live preview: <a href="http://jsfiddle.net/rcMGn/1/" rel="nofollow">http://jsfiddle.net/rcMGn/1/</a>)</p> <p>Basically what I'm doing here is getting the first node with class formwidth (as per your css) and using the DOM model to acquire its style properties.</p> <p>The function getElementsByClass will return an array of all elements in the document with class formwidth (and I'm supposing there's going to be only one) and getting the first element from the array (which is supposed to be 1) and then styling it.</p> <p>You don't need to care about the function... To get the width just the first line of the code below...</p> <pre><code>formWidth = getElementsByClass('formbody',null,'form')[0].offsetWidth; </code></pre> <p>To get the height, use this one:</p> <pre><code>formHeight = getElementsByClass('formbody',null,'form')[0].offsetHeight; </code></pre> <p>and copy the function from the files of <a href="http://www.dustindiaz.com/getelementsbyclass" rel="nofollow">Dustin Diaz</a>, the function below...</p> <pre><code>function getElementsByClass(searchClass,node,tag) { var classElements = new Array(); if ( node == null ) node = document; if ( tag == null ) tag = '*'; var els = node.getElementsByTagName(tag); var elsLen = els.length; var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)"); for (i = 0, j = 0; i &lt; elsLen; i++) { if ( pattern.test(els[i].className) ) { classElements[j] = els[i]; j++; } } return classElements; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload