Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Resize popup window to fit text

Reply
Thread Tools

Resize popup window to fit text

 
 
Terren
Guest
Posts: n/a
 
      09-28-2005
I have a popup window that is used to display text from a database.
Some times it can be a few words, sometimes it can be a hundred words.

What I would like to do is resize the popup window to fit the text.
Well actually it is just the height that needs to be resized. I have
set the width to 600. I have put the text in a table and I was thinking
I could set the height of the window to be the height of the table plus
some for room. I don't know if that is possible.

At first I tried to count the number of lines and multiple by a factor
by that doesn't work so nicely because I was getting the number of
lines by dividing the number of charaters by the maximum number of
characters in a line.

Let me know if I am just being stupid and I should abondon this quest

 
Reply With Quote
 
 
 
 
Terren
Guest
Posts: n/a
 
      09-29-2005
What? No one replied? Well here is the solution. Turns out it is really
easy, maybe that is why no one replied.

Here is the script function to do this.

<script type="text/javascript">
function ChangeHeight(window_width){
var mtop,mleft
if (screen.height>
document.getElementById("table_id").offsetHeight){
//resize window
window.resizeTo(window_width,document.getElementBy Id("table_id").offsetHeight+75);
// The +75 is because the title bar takes up some space. I am sure that
this will be different for different resolutions
//Center Window
mtop=(screen.height/2)-(window.length/2);
mleft=(screen.width/2)- (window_width/2);
window.moveTo(mleft,mtop);
}else{
//resize window
window.resizeTo(window_width,screen.height-75);
//Center Window
mtop=(screen.height/2)-((screen.height)/2);
mleft=(screen.width/2)-(window_width/2);
window.moveTo(mleft,mtop);
}//end if
}//end function
</script>

 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      09-29-2005
Terren wrote on 29 sep 2005 in microsoft.public.inetserver.asp.general:
> What? No one replied? Well here is the solution. Turns out it is really
> easy, maybe that is why no one replied.



No one replied,
because you are asking a clientside Q in a serverside scripting NG,
and so you were off topic.

Choose your NG carefully according to your Q.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

 
Reply With Quote
 
Terren
Guest
Posts: n/a
 
      09-29-2005
Good point

 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      09-29-2005
Terren wrote on 29 sep 2005 in microsoft.public.inetserver.asp.general:
> Good point


Could be,
but if you don't quote what you are anwering on,
as per Netiquette,
how are we to know what you are talking about?

This is not email, but usenet.


--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Resize an image to fit a CSS without knowing if it is portrait orlandscape shape zorro HTML 9 07-06-2007 09:23 PM
Re: Resize Page Header to fit screen Steve C. Orr [MCSD, MVP, CSM, ASP Insider] ASP .Net 0 01-22-2007 07:25 PM
New Popup Window from an existing Popup Window Raffi Javascript 4 08-12-2004 01:21 PM
Make wxListCtrl fit around contents and parent frame fit around listctrl Piet Python 0 07-18-2004 08:27 AM
Main > Popup > Popup > Close popup AND new URL in main? Jens Peter Hansen Javascript 7 06-19-2004 08:56 PM



Advertisments