This baffles me that I have searched for a full day all over the place and can't find the way to make this work. Surely this is a common need? All I want to do is resize my window to fit the content displayed.
I've been to MS scripting center, 4 guys from rolla... no body does anything but set size to static values
I am using VBS
I have tried everything I can find to set the height and width to.
document.body.clientheight, scrollheight,offsetHeight
and widths
document.documentelement.*
and at least a dozen other variations I have found (all javascript examples I've attempted to translate)
I've tried doing it before and after spanname.innerhtml =
I've torn my display apart trying to account for CSS divs and have it down to nothing but a body statement...
This can't really be this difficult can it?
Please Help.
window.resizeto based on content
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- kenthompson
- Posts: 14
- Last visit: Tue Mar 02, 2010 3:39 am
window.resizeto based on content
This baffles me that I have searched for a full day all over the place and can't find the way to make this work. Surely this is a common need? All I want to do is resize my window to fit the content displayed.
I've been to MS scripting center, 4 guys from rolla... no body does anything but set size to static values
I am using VBS
I have tried everything I can find to set the height and width to.
document.body.clientheight, scrollheight,offsetHeight
and widths
document.documentelement.*
and at least a dozen other variations I have found (all javascript examples I've attempted to translate)
I've tried doing it before and after spanname.innerhtml =
I've torn my display apart trying to account for CSS divs and have it down to nothing but a body statement...
This can't really be this difficult can it?
Please Help.
I've been to MS scripting center, 4 guys from rolla... no body does anything but set size to static values
I am using VBS
I have tried everything I can find to set the height and width to.
document.body.clientheight, scrollheight,offsetHeight
and widths
document.documentelement.*
and at least a dozen other variations I have found (all javascript examples I've attempted to translate)
I've tried doing it before and after spanname.innerhtml =
I've torn my display apart trying to account for CSS divs and have it down to nothing but a body statement...
This can't really be this difficult can it?
Please Help.
window.resizeto based on content
Can you be more specific on "content displayed"? Are you saying if you only displayed an image that was 120 x 120 that the window would be resized to only 120 x 120?
window.resizeto based on content
What is stopping you from just setinng the size of teh spam when you add content?
I believe it looks like this: object.style.width = 99
You can add scrioll bars or use a multiline control with autoscroll and move the thumb to the bottom.
I believe it looks like this: object.style.width = 99
You can add scrioll bars or use a multiline control with autoscroll and move the thumb to the bottom.
window.resizeto based on content
Set overflow to auto and it will produce scroll bars. A "thumb" is the thing that moves the scroll bar. The little do-hickie that moves up and down.
style="overflow: auto;"
It works on DIV and TEXTAREA but no on a SPAN. A span is a containment tag not normally used for content but to wrap other tags.
style="overflow: auto;"
It works on DIV and TEXTAREA but no on a SPAN. A span is a containment tag not normally used for content but to wrap other tags.
- kenthompson
- Posts: 14
- Last visit: Tue Mar 02, 2010 3:39 am
window.resizeto based on content
That's it! You gave me the key to figuring it out, jvierra. What you said and the information I've been staring at here: http://msdn.microsoft.com/en-us/library ... S.85).aspx linked together to create my solution.
On my main content column in my css I specified overflow:auto then in my resizer function I did this:
screenWidth = contentcolumn.scrollWidth + 100screenHeight = contentcolumn.scrollHeight + 200window.resizeto screenWidth,screenHeight
the added values at the end are to account for other divs in my window whose sizes are static.
It works!
thanks so much for your help!
On my main content column in my css I specified overflow:auto then in my resizer function I did this:
screenWidth = contentcolumn.scrollWidth + 100screenHeight = contentcolumn.scrollHeight + 200window.resizeto screenWidth,screenHeight
the added values at the end are to account for other divs in my window whose sizes are static.
It works!
thanks so much for your help!