473,769 Members | 6,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5580
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(wi ndow_width){
var mtop,mleft
if (screen.height>
document.getEle mentById("table _id").offsetHei ght){
//resize window
window.resizeTo (window_width,d ocument.getElem entById("table_ id").offsetHeig ht+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.he ight/2)-(window.length/2);
mleft=(screen.w idth/2)- (window_width/2);
window.moveTo(m left,mtop);
}else{
//resize window
window.resizeTo (window_width,s creen.height-75);
//Center Window
mtop=(screen.he ight/2)-((screen.height )/2);
mleft=(screen.w idth/2)-(window_width/2);
window.moveTo(m left,mtop);
}//end if
}//end function
</script>

Sep 29 '05 #2
Terren wrote on 29 sep 2005 in microsoft.publi c.inetserver.as p.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.publi c.inetserver.as p.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
7960
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 use JS in my listing, is there a way of using JS to resize a current window, and remove the toolbars etc, so it looks like a pop-up? --
2
10414
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 the same window, just sized differently. Here's the script I'm currently using: <a href="#"...
8
2409
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 height is. The window, of course has things like menu bars, toolbar, navigation, etc. I need to account for these when I resize the image, but I'm not seeing how to do that. I'm sure this must be done frequently, but I'm not seeing the solution. ...
3
1917
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 popup(mylink, windowname) {
14
31969
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 page that is fullscreen big and move to co-ordinates (0,0) I've written some code to do that: <script language="JavaScript"> <!-- function resize_()
1
11582
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 http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all out). Therefore, here goes my simple "web dialog box with parent event handler fireing" solution. ...
7
2371
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. Do you know how to do this? TIA
5
27196
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 generator=window.open('','name','height=500,width=675,resizeable=1,toolbar=0,menubar=0,scrollbars=1'); I also tried it with 'no' and 'yes' instead of '0' and '1'. I see the symbol in the window that I can click and drag, but, when I do click and drag, nothing happens.
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10050
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9999
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.