Window size (Full Version)

All Forums >> [Web Development] >> General Web Development



Message


_gail -> Window size (12/27/2001 20:56:38)

I know there is a fairly simple java script which causes a window to open at a specified size when the link to it was clicked on from another page. Can anyone tell me what it is? I've searched, to no avail. The action when one clicks on the "preview" button here is exactly what I'm looking for.

Thank you.

Gail

PS Haven't visited here for a while. Very nice improvements to the site. Congratulations and thanks!




caywind -> RE: Window size (12/28/2001 1:15:55)

is this it?

http://www.michael-thomas.com/javascript/ex_window_openclose.htm

All this to change a number into a name...




_gail -> RE: Window size (12/28/2001 9:17:16)

Thank you, but no. This script creates a button.

I want to be able to create my own button (or use a word which can be linked to the smaller page). I want to hyperlink my button to a *page* that itself is smaller. The window size needs to be in the *page* itself. If I then wanted to make a link to it from any other page in a web, it would always open the smaller size.

Hope I've explained myslef correctly.

Any further suggestions would be appreciated. Thanks.




rdouglass -> RE: Window size (12/28/2001 10:09:29)

I think this is what you're looking for...

Lets assume the page (that you want to open)is 'myInfo.htm' and you want it 500 x 300 pixels and you want it 10 pix in and 10 pix down from top left corner of screen. Put this code in your <head> </head> section of your targeted page:

<script>
function sizeMe() {
window.moveTo(10,10);
window.resizeTo(500,300)
}
</script>

Then, make the <body> tag look like this:

<body onload="javascript:sizeMe('myInfo.htm')">

Now, just be sure that when you open the page for a popup, you use target="_blank" in your hyperlink so it will open a new window and not load in the current window.

Caywind's sugestion would also work if you included a little in the Javascripts - namely size and location of window. I think however, this is what you're looking for.

Hope this helps....

EDIT: Can't spell worth crap!!

Edited by - rdouglass on 12/28/2001 10:11:48




_gail -> RE: Window size (12/28/2001 11:26:56)

Thank you!

I'm obviuosly over my head. In any case, here's what I tried, with no success (and do not know how to correct the script):


<SCRIPT LANGUAGE="JavaScript">

<script><BR>function sizeMe()
{<BR>window.moveTo(10,10);<BR>window.resizeTo(300,300)<BR>}<BR></script>

// End -->
</SCRIPT>
</head>

<BODY>
<body bgcolor="#FCFCF5" link="#008000" vlink="#00A8A8" alink="#00F4F4">
<SCRIPT LANGUAGE="JavaScript">
<body onload="javascript:sizeMe('popup-page.htm')">

// End -->
</SCRIPT>




rdouglass -> RE: Window size (12/28/2001 12:14:36)

OOPS! Should have told you: you need to copy and paste the code (from this forum) into Notepad first, then copy and paste into FP HTML view. That will get rid of all the formatting code ("<br>"s and such). It does need to look just like this:

<head>
(any other head code you have)
<script>
function sizeMe() {
window.moveTo(10,10);
window.resizeTo(300,300)
}
</script>
</head>

Also, you can't have 3 <body> tags - only 1. Make all of this:

<BODY>
<body bgcolor="#FCFCF5" link="#008000" vlink="#00A8A8" alink="#00F4F4">
<SCRIPT LANGUAGE="JavaScript">
<body onload="javascript:sizeMe('popup-page.htm')">

Look like this:

<body bgcolor="#FCFCF5" link="#008000" vlink="#00A8A8" alink="#00F4F4" onload="javascript:sizeMe('popup-page.htm')">

All of this needs to be on the popup-page.htm. Again, be sure to copy and paste into Notepad first....

 

Edited by - rdouglass on 12/28/2001 12:15:22




Xtreme2000 -> RE: Window size (12/28/2001 14:44:15)

You can also do this if you want.


In the <head> tag area put these in there
<script language="JavaScript">
<!--
function open_on_entrance(url,name)
{

new_window = window.open('/yourfile.html','', ' menubar,resizable,dependent,status,width=400,height=250,left=10,top=10')}
// -->
</script>



In the <body> tag put the onload command in:
<body onload="open_on_entrance()">

WOLA!! you now will have the popup page.

Xtreme 2000
I do it right, and I'll do it right the first time!!!
Site in progress: http://Xtreme2000.idbinc.net





_gail -> RE: Window size (12/28/2001 17:54:50)

I finally got it right, thanks to all those who offered help here (www.arborsnews.com > "See what's new" button). I can't tell you how much I appreciate it!

Happy New Year.

 




Xtreme2000 -> RE: Window size (12/29/2001 20:55:51)

You're welcome Gail.. Happy New year!!!

Xtreme 2000
I do it right, and I'll do it right the first time!!!
Site in progress: http://Xtreme2000.idbinc.net





_gail -> RE: Window size (12/30/2001 12:28:06)

Is there a code to make the window "always on top" until you close it?

 




tryin_to_learn -> RE: Window size (10/22/2005 7:46:51)

I found this thread via Google and it's exactly what I'm wanting, even though it's 4 years old. Hooray for Google. : )

Basically, I've got the same question as Gail except I'd also like to know how to control the chrome. rdouglass's solution works except I don't know where or how to put the window properties I need. I could do it for a popup, but since this is the window itself, I'm stumped. Xtreme2000's solution opens an original window and then puts the popup on top of it, which I'd rather avoid. I'm making a media player, so I only want one relatively small, chromeless window to open when you put the URL in your browser window.

Can anyone help?




jaybee -> RE: Window size (10/22/2005 8:13:17)

Welcome to OF.

This gives you all the parameters available.
http://www.javascripter.net/faq/openinga.htm




jaybee -> RE: Window size (10/22/2005 8:14:55)

As far as a window staying on top, it can be done but like most things doesn't work in all browsers. There is a hack which involves giving the pop-up focus ever time it loses focus but it then becomes a pain if you're trying to work with the background page.




tryin_to_learn -> RE: Window size (10/22/2005 8:35:32)

Thanks for the quick reply! However, unless I'm missing something, I don't think that's what I'm wanting. Is there a way to use those same properties but not as a popup -- I want to be able to just plop a URL in the address bar of my browser and have the window that opens be small and chromeless. I want there to only be one window -- no popup. Make sense? Is that possible?




BeTheBall -> RE: Window size (10/22/2005 10:24:05)

Not possible. The size of the window will be the same as the window was when you entered the URL into the address bar.




tryin_to_learn -> RE: Window size (10/22/2005 11:03:06)

Ok, thanks. Now at least I don't have to keep fiddling with it and wondering why I'm not getting it.




tryin_to_learn -> RE: Window size (10/22/2005 11:17:00)

Ok, but wait a sec . . . I thought about this some more. rdouglass's sizeMe function resizes the window as it opens -- which seemed to accomplish what I wanted. It's just that it had all the annoying chrome on it. I thought there might be a way to add the properties to his function. I tried window.toolbar = false; window.toolbar = no; self.toolbar, etc, but none of those worked. Since the window is being resized onload, shouldn't there be a way to access its properties and manipulate those as well?




jaybee -> RE: Window size (10/22/2005 12:16:06)

As far as I'm aware the chromeless properties only work with window.open. pop-ups. The other commands only have size parameters.




jaybee -> RE: Window size (10/22/2005 12:18:35)

This link takes you to the chromeless guru. If there's nothing there then it can't be done.

There is a problem however, I can't get it to open in IE and in FF it isn't chromeless so I guess the hack isn't that good after all.

You may have better luck with the forum which is on
http://www.domestika.org/foros/viewforum.php?f=917

How good is your Spanish?




tryin_to_learn -> RE: Window size (10/22/2005 16:07:06)

Thanks. I took one look at some of those posts and decided it was too much sugar for a nickel. If it doesn't work on FF anyway, it doesn't seem worth doing. I'll just go back to the popup style.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.078125