PDA

View Full Version : A Centered Pop-up window


TRex
12-30-2002, 05:19 AM
hello....

I used the pop-up window and its a great idea... will surely pass it on to my friends... but I would like the window to open centered in the window... can anyone help?

thanx!:D

PauletteB
12-30-2002, 06:11 AM
Could you post the pop-up window code you want modified?

TRex
12-30-2002, 06:49 AM
oh... I am sorry about that... I left out the word "generator" in the above post... the code I got was this:

--------------------

<script>

//Popup Window Script
//By JavaScript Kit (http://javascriptkit.com)
//JavaScript tutorials and over 400+ free scripts

function openpopup(){
var popurl="thankyou.htm"
winpops=window.open(popurl,"","width=400,height=338,status,resizable,")
}

</script>

<a href="javascript:openpopup()">Click here to open window</a>

--------------------

thanx!

PauletteB
12-30-2002, 07:37 AM
One way...

<body>
<script language="JavaScript" type="text/javascript">
function mkWin() {
var w = 400;
var h = 338;
var X = (screen.availWidth - w) / 2;
var Y = (screen.availHeight - h) / 2;

var popUp = window.open("","popUp","status=yes,resizable=yes,width="+w+",height="+h+",left="+X+",top="+Y+"")
}
</script>
<a href="thankyou.htm" target="popUp" onClick="mkWin()">Click here to open window</a>
</body

codefox
12-30-2002, 08:13 AM
I was thinking on the same lines, but is trek asking for centering the popup window on the screen or the parent window?

TRex
12-31-2002, 06:41 AM
centering the pop up....

thank you kindly Paulette!