RSS

How to open new window (popup) and center on screen

22 Jul

Hi …

the advantage  of this java script function you just place in master page and call any where at page ……..
<html>
<head>
<title>Popup Window</title>
<script language=”javascript” type=”text/javascript”>
<!–
var win=null;

function NewWindow(mypage,myname,w,h,scroll,pos){

if(pos==”random”)
{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}

if(pos==”center”)
{LeftPosition=(screen.width)?(screen.width-w)/2:100;
TopPosition=(screen.height)?(screen.height-h)/2:100;}

else if((pos!=”center” && pos!=”random”) || pos==null){LeftPosition=0;TopPosition=20}

settings=’width=’+w+’,height=’+h+’,top=’+TopPosition+’,left=’+LeftPosition+’,scrollbars=’+scroll+’,l ocation=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes’;

win=window.open(mypage,myname,settings);}
// –>
</script>
</head>

<body>

<table width=”100%” height=”100%”>

<tr>
<td align=”center” valign=”middle”>
<a href=”https://humrahimcs.wordpress.com&#8221; onclick=”NewWindow(this.href,’newwindow’,’450′,’500′,’yes’,’center’);return false” onfocus=”this.blur()”>Popup Window</a>
</td>
</tr>
<tr>

</table>
</body>
</html>

Advertisements
 
Leave a comment

Posted by on July 22, 2011 in Java Script

 

Tags: , , , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: