Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically size a browser window according to the content within...

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have a pop up browser window which displays varying/dynamic content. Rather than leave the scrolling feature on I want to have the window change size and fit snuggly around the content, whether it be one sentnece or a couple of paragraphs. Is this possible with VBscript?

I should mention that I have no experience with VBscript. Thank you for any help.
 
no not too advanced. I don't think that's possible around here. I'm not sure you can do this howver. If you did it would be a client side script like javascript. The only way I can even go to in theory is to get the length of the objects you have in the window by saving them to variables and using the length function then apply them to the opener statement. are the contents coming from a DB?

you need to be a little more specific in the question
how is the window opened
what is the content and where is it coming from etc.. Was it something I said?
admin@onpntwebdesigns.com
 
The window is opened from an already dynamically generated page, by a button. The content is called form a database using Coldfusion. The content is just text with some links, the page is a basic CF template.

For some reason I was thinking that Javascript would not be the answer, but what do I know? Definitely not VBscript or Javascript.
 
well, I messed around for a minute and I came up with this. you'll need a lilttle more calc's to really obtain the right sizes but it seemes to go in the right direction

<html>
<head>
<%
dim winwidth, winheight
'the below would be the RS's
session(&quot;width&quot;) = &quot;This is some content that would coem from the DB, you would just add the record set here&quot;
session(&quot;height&quot;) = &quot;And the height here&quot;
winwidth = Len(session(&quot;width&quot;))
winheight = Len(session(&quot;height&quot;))
%>
<script language=&quot;javascript&quot;>
function openwin() {
var wth = &quot;<%= winwidth %>&quot;*1
var ht = &quot;<%= winheight %>&quot;*1
winpops=window.open(&quot;show.asp&quot;,&quot;&quot;,&quot;width=+wth+,height=+ht+,toolbar&quot;)
}
</script>
</head>
<body>
<%
response.write &quot;test&quot; & &quot;<br>&quot;
response.write session(&quot;width&quot;) & &quot;<br>&quot;
response.write session(&quot;height&quot;) & &quot;<br>&quot;
response.write winwidth & &quot; &quot; & winheight

%>
<a href=&quot;javascript:eek:penwin()&quot;>Click here to see the content</a>
</body>
</html>

am I close [lol] Was it something I said?
admin@onpntwebdesigns.com
 
Thanks onpnt, I will see what I can do with this, it looks promising.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top