html/javascript question
#1
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
Is there a command or javascript to get the window to pop-up in the centre of the screen?
Cheers,
Gareth
#2
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]
<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]
#3
<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]
<!--
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]
Thread
Thread Starter
Forum
Replies
Last Post
Brzoza
Engine Management and ECU Remapping
1
02 October 2015 05:26 PM