473,408 Members | 2,113 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,408 software developers and data experts.

Centering Browser Pop-Up Window?

Joe
Hi- What do I need to add to this to make it pop up in the centre of the
screen:

<SCRIPT LANGUAGE="JavaScript">
function pop() {
window.open("current.htm","","height=200,width=200 ,left=0,top=0");
}
</script>

Thanks - Joe
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 01/09/2003
Jul 20 '05 #1
5 5175
"Joe" <so****************@grapevine.net> writes:
Hi- What do I need to add to this to make it pop up in the centre of the
screen:
Don't!
<URL:http://www.infimum.dk/HTML/JSwindows.html#ref_3_3>

If you insist, see below.
<SCRIPT LANGUAGE="JavaScript">
<script type="text/javascript">
The type attribute is required in HTML 4
function pop() {
var left = Math.floor((screen.availWidth - 200) / 2);
var top = Math.floor((screen.availHeight - 200) / 2);
window.open("current.htm","","height=200,width=200 ,left="+left+",top="+top);
}


/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
Joe
> > Hi- What do I need to add to this to make it pop up in the centre of the
screen:
Don't!
<URL:http://www.infimum.dk/HTML/JSwindows.html#ref_3_3>

If you insist, see below.
<SCRIPT LANGUAGE="JavaScript">


<script type="text/javascript">
The type attribute is required in HTML 4
function pop() {


var left = Math.floor((screen.availWidth - 200) / 2);
var top = Math.floor((screen.availHeight - 200) / 2);

window.open("current.htm","","height=200,width=200 ,left="+left+",top="+top);
}


/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'


Thanks
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 01/09/2003
Jul 20 '05 #3
Joe
Any idea how to add a scroll bar while I'm here?

<script type="text/javascript">
function pop() {
var left = Math.floor((screen.availWidth - 600) / 2);
var top = Math.floor((screen.availHeight - 300) / 2);
window.open("current.htm","","height=300,width=600 ,left="+left+",top="+top);
}
</script>

Thanks - Joe
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 01/09/2003
Jul 20 '05 #4
"Joe" <so****************@grapevine.net> writes:
Any idea how to add a scroll bar while I'm here?


window.open("current.htm","","height=300,width=600 ,left="+left+
",top="+top+",scrollbars=yes,resizable=yes");

See: <URL:http://www.infimum.dk/HTML/JSwindows.html#ref_3_2>

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #5
In article <1x**********@hotpop.com>, Lasse Reichstein Nielsen <lr*@hotpop.com>
writes:
var left = Math.floor((screen.availWidth - 200) / 2);
var top = Math.floor((screen.availHeight - 200) / 2);

window.open("current.htm","","height=200,width=20 0,left="+left+",top="+top);


And even that is not sure to work. My browser gives screen.availWidth as 2048,
yet my displays don't allow window spanning, so it can only use 1024 on either
monitor. Gives a nasty result when run as above :(
--
Randy
Jul 20 '05 #6

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

Similar topics

15
by: Vorpal Chortler | last post by:
I've got a web customer complaining about centered text when it's not supposed to be. I just looked over at browsercam and it only appears on Win IE 6 - Nothing else, EVERYTHING else is justified...
9
by: Pierre Jelenc | last post by:
Is there a way to center (horizontally) a UL list of unknown width? I can put it in a DIV that's centered with "margin-left: auto; margin-right: auto;" but I then have to specify a width; otherwise...
3
by: Wayfarer | last post by:
I *HAVE* Googled the hell out of it, but there's nothing I can understand (in words of one syllable or less) that works for me. If you go to http://www.journeys.ws/layout.html, on the...
3
by: yawnmoth | last post by:
I'm trying to center list elements in a webpage I'm working on, and setting margin-left to auto for ol (or ul) seems to prevent the number (or bullet) from displaying in IE6 (strict mode) and...
6
by: Simon Wigzell | last post by:
I have the following funciton that centers my website content for any size window and will center it in real time as the window is expanded or shrunk. It is activated by a onresize="CenterIt();"...
13
by: Raffi | last post by:
Hi, We have an application that requires IE. We recently incorporated CSS scroll areas. The scroll fields are supposed to be centered. They are except for IE5 for the Mac. I have tried various...
3
by: Robert Latest | last post by:
Hello, me again. This time I'd like to align a DIV both horizontally and vertically centered within a larger DIV. The only alignment-relevant CSS property I could think of was text-align, and...
1
by: Arnost Sobota | last post by:
Hello, I am aware that the correct way to center a block-level element is to set the left and right margins to auto. However, this seems to only if the element to be centered has a width...
1
by: pbd22 | last post by:
Hi all. I am using styles to lock down the GUI until the user enters some info in a CSS/DIV pop box. If the user does now scroll before he clicks, the pop box is centered and the background...
1
by: =?Utf-8?B?ZnJhbmt5?= | last post by:
Hello, I've created a table that has two rows that are span across three columns. The third row has three columns, each with an image. The last row is also span accross three columns. The span...
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
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,...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
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.