Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

html/javascript question

Thread Tools
 
Search this Thread
 
Old 13 December 2002, 11:31 AM
  #1  
Da Booga
Scooby Regular
Thread Starter
 
Da Booga's Avatar
 
Join Date: May 2002
Posts: 732
Likes: 0
Received 0 Likes on 0 Posts
Post

This is probably a really simple question to you techie web types but I can't seem to work out how to make a window pop-up in the centre of the screen. I can set the top=x, left=x values to get the window to open in the centre of a 1024x768 screen but obviously the settings are incorrect for other resolution displays.

Is there a command or javascript to get the window to pop-up in the centre of the screen?

Cheers,

Gareth
Old 13 December 2002, 12:28 PM
  #2  
Michael Robinson
Scooby Regular
 
Michael Robinson's Avatar
 
Join Date: May 2002
Posts: 831
Likes: 0
Received 0 Likes on 0 Posts
Post

use javascript mate

<script language="JavaScript">
{alert('What you want to say');}
</script>

ok mate, this will always be centre. Might want to set a function before it though.

[Edited by Michael Robinson - 12/13/2002 12:35:38 PM]
Old 13 December 2002, 01:18 PM
  #3  
legacyPete
Scooby Regular
 
legacyPete's Avatar
 
Join Date: Dec 2001
Posts: 202
Likes: 0
Received 0 Likes on 0 Posts
Post

<script language="JavaScript">
<!--
var win;

function popup(url, winw, winh, resize) {
var width = winw;
var height = winh;
var left = (screen.availWidth - width) / 2;
var top = (screen.availHeight - height) / 2;
win = window.open(url,"popWin","toolbar=0,location=0,dir ectories=0,menuBar=0,scrollbars=1,resizable="+resi ze+",top="+top+",left="+left+",width="+width+",hei ght="+height);
win.focus();
win = null;
}
//-->
</script>

e.g. to call the script:

<a href="javascriptopup('apage.htm', 500, 350, 1)">open</a>

Will open apage.htm in a 500px x 350px window with scroll bars enabled

Edit: stupid bloody bbs code!

[Edited by legacyPete - 12/13/2002 1:18:57 PM]
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
KAS35RSTI
Subaru
27
04 November 2021 07:12 PM
slimwiltaz
General Technical
20
09 October 2015 07:40 PM
IanG1983
Wheels, Tyres & Brakes
2
06 October 2015 03:08 PM
Brzoza
Engine Management and ECU Remapping
1
02 October 2015 05:26 PM
the shreksta
Other Marques
26
01 October 2015 02:30 PM



Quick Reply: html/javascript question



All times are GMT +1. The time now is 11:29 AM.