views:

51

answers:

2

i have a webpage that looks like this:

http://yoursdproperty.com/index2.php?option=com_jumi&fileid=3&Itemid=11

i want the page to be the same size as the dimensions of the little form on the page.

is there something i can modify in this code of the page?

<div id="mlcalc-w1">
<div id="mlcalc-w2">
<div id="mlcalc-w3">
<div id="mlcalc-w4">
<div id="mlcalc-w5">
<link rel="stylesheet" type="text/css" media="screen,projection" href="http://www.mortgageloan.com/sites/all/themes/mortgageloan/css/tool/mlcalc-inline.css"&gt;
<div id="mlcalc-pres">
<h2 id="mlcalc-head">
<em>19 Mortgage Calculators</em> <em><a href="http://www.mortgageloan.com/widgets/#tool-num-4" rel="nofollow" target="_blank">Get this Widget</a><span></span></em>
</h2><iframe id="mlcalc-calc" src="http://www.mortgageloan.com/tool/mortgage/mortgage-calculator-package-content" scrolling="no" border="0" frameborder="0"></iframe>
<p id="mlcalc-footer">
Related Resource: <a href="http://www.mortgageloan.com/"&gt;Refinance &amp; Mortgage Rates</a>. Calculator © MortgageLoan.com.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
+1  A: 

You could use JavaScript to get the computed height and width of the element that you want to resize to and pass them to the window.resizeTo method.

A simple example:

This code courtesy of Robert Nyman:

function getStyle(oElm, strCssRule){
    var strValue = "";
    if(document.defaultView && document.defaultView.getComputedStyle){
        strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
    }
    else if(oElm.currentStyle){
        strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
            return p1.toUpperCase();
        });
        strValue = oElm.currentStyle[strCssRule];
    }
    return strValue;
}

Now for my code:

window.onload = function() {
    var element = document.getElementById( 'micalc-calc' );
    var width = getStyle( element, 'width' );
    var height = getStyle( element, 'height' );
    window.resizeTo( parseInt( height ), parseInt( width ) );
};
Jacob Relkin
can you send the code please
I__
yankele where exactly in yerushalaim are u living?
I__
Wow. Another fellow yid on SO? I am blown away!
Jacob Relkin
:) you should have lots of parnassa and go from chizuk to chizuk and find the right girl at the right time
I__
sorry man i know NOTHING about webprogramming, can u just type all the code so i can copy and paste
I__
I'm in the ESP at JCT/Machon Lev. Thank you!
Jacob Relkin
thank you so much man, now how do i incorporate those two pieces in my code? can you just copy and paste everything togehter so that it is with my code?
I__
here you go: http://pastie.org/798399
Jacob Relkin
Where exactly are YOU living?
Jacob Relkin
thank you very much but looks like it did not work http://www.yoursdproperty.com/ click on MORTGAGE CALCULATORS.......im living in san diego california, my rav lives in measharim and he's a breslover but we are lubovitchers
I__
A: 

Its probably worth noting that it's generally considered a good idea not to resize a browser window via JavaScript, or any way after the window is created. The main reason being that someone may have opened the page in a new tab and you're then resizing all their pages. Rather, have the link that opens the window do so with a size set for it.

RHSeeger
i appreciate the input but in this case you can probably suggest to me how to resize it before it opens
I__