Popup Window matching height and width of its content? Possible?
Well, I know how to make popups though the javascript code, I have come across a situation where the content inside the popup will be different everytime... I want the popup window height and width to match the contents Attributes... Anyone know of a way? Thnx in advance...
Now, in some browsers offsetWidth returns only the width of the inner part of the window, not including the status bar, title bar, etc. So, you can either add a constant number of pixels in the resizeTo function's width and height, or use the modified resize function in place of the one above:
Code:
function resizeOuterTo(w,h) {
if (parseInt(navigator.appVersion)>3) {
if (navigator.appName=="Netscape") {
top.outerWidth=w;
top.outerHeight=h;
}
else top.resizeTo(w,h);
}
}
Hmmm... I tried it, and it doesn't seem to work, It simply makes the popup window size very small regardless of what is inside or what i describe the popup window to be... I wonder if im doing something wrong...
I have this script in the header of the main page:
Code:
<SCRIPT TYPE="text/javascript">
<!--
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, windowname, 'width=400,height=200,scrollbars=yes');
return false;
}
//-->
</SCRIPT>
And, This code on the link to the pop up window:
Code:
<A
HREF="popupwindow.html"
onClick="return popup(this, 'notes')">like to popup</A>
Then I pasted the body tag you posted into the pop up page, but it size to the content, in fact it simply makes it very small regardless of anything...
Thnx, ill give this one a try...i think i might be able to edit this to make it suit my needs... Still, if there are any other ideas please let me know...
I've got another one for you to try. What you should do is wrap the entire contents of your popup in a div called "wrapper". So your popup html would look like
Thanks TripperTreats for your latest reply, i used the code you provided and it seems to work partially...
It resizes the window, however not fully, I am actually trying to work with it and trying to get it to work, but im still having a little trouble... I have to define the the wrapper id definitely, keeping it auto doesn't seem to work, which defeats my purpose... Here's what im looking at as the code for my popup window... The wrapper if resizes when i have it as auto, but the window does not along with it.