Forum Moderators: open
The code I'm using is:
In the HEAD or External JS file:
function cPop(url, wide, high)
{window.open(url,"popup",'width=' + wide + ',height=' + high);
}
In the BODY:
<a href="javascript:cPop('page.html',300,500)">Click for popup window</a>
as posted by Tedster in the thread on Handy Generic Javascipt [webmasterworld.com]
Has anyone else seen this? Is there a workaround?
In the HEAD (or external JS omit the <script> tags):
<script language="JavaScript" type="text/javascript" src="/scripts/menu.js">
<!--
var win= null;
function NewWindow(mypage,myname,w,h,scroll){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
settings='height='+h+',width='+w+',top='+wint+',left='+winl+',
scrollbars='+scroll+',toolbar=no,location=no,status=no,menubar=no,
resizable=no,dependent=no'
win=window.open(mypage,myname,settings)
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
//-->
</script>
On the page:
<a
href="javascript:NewWindow('/your_page.html,'popup','360','400','no')">text_link</a>
<NOTE: edited to prevent side scrolling. In actual use there should be no line breaks in the string of windows attributes.>
[edited by: tedster at 7:17 am (utc) on Oct. 8, 2002]