473,416 Members | 1,623 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Resize popup window to fit text

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

Sep 28 '05 #1
4 5546
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>

Sep 29 '05 #2
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)

Sep 29 '05 #3
Good point

Sep 29 '05 #4
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)

Sep 29 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Nigel Mercier ® | last post by:
I'm just starting to learn JavaScript, so far I like it! I want to add some JS to my Ebay listings, to manually open a pop-up window. It works OK, but the JS gets rejected by Ebay. If I can't...
2
by: Fleemo | last post by:
Is there any way to have a browser window resize itself when displaying a new HTML page? I'm using the javascript below to open a NEW window at a certain size, but I'd prefer the page to load in...
8
by: Michael Satterwhite | last post by:
I'm opening a page that has a single image on it. I'd like to resize the window containing the image to the size of the image (slightly larger OK, not smaller). The width isn't a problem, but the...
3
by: alazar_076 | last post by:
Hey, I am using javascript for pop-ups, but I want each pop-up on the page to have its own resize. This is the code that I have: <HEAD> <SCRIPT TYPE="text/javascript"> <!-- function...
14
by: franz | last post by:
hallo everyone, i have a popup window 500x400px centered in the middle of the screen and inside it there's a mini-photogallery. what i want is to click on a thumbnail and open in the same window a...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
7
by: windandwaves | last post by:
Hi Folk I use a pop-up window on www.wapitipark.co.nz to view images. On some sites, I saw (a long time ago) a trick where they use Javascript to resize the window to the size of the image. ...
5
by: James Black | last post by:
In Firefox I can resize the window that is created, but in IE I can't. Here is the code I am using: var...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.