[thelist] How do I get around this?

Olly Hodgson mailinglists at planetgnarly.com
Sun Jan 5 16:16:01 CST 2003


On Sun, 5 Jan 2003 16:47:16 +0100, <evolt at headhouse.dk> wrote:

> Could it be that a pop-up blocker causes it to fail?

Probably. Take a look at this article on evolt for how to make your links
more accessible.
http://www.evolt.org/article/Links_and_JavaScript/17/20938/

> Oh .. and yes ... I have tried to make that pop-up center on the
> monitor ... but I never succeded ... if someone can give me a hint on
> that too ... I'll be happy as a kid on christmas eve.

The script I use was given to me on this very list by Anthony Baratta, and
I adapted it to make it more accessible (so the link will still work with
popup blockers, or if javascript is disabled, etc).

Put this in the <head> of your document:

<script language="JavaScript" type="text/javascript">
<!--
// popWindow function by Anthony Baratta, Opens new window in centre of
screen
function popWindow(theURL,winName,winWidth,winHeight,otherFeatures) {
   var x = 0;
   var y = 0;
   x = (screen.availWidth - 12 - winWidth) / 2;
   y = (screen.availHeight - 48 - winHeight) / 2;
   if (otherFeatures != "") {otherFeatures = "," + otherFeatures}
   var features = "screenX=" + x + ",screenY=" + y + ",width=" + winWidth +
",height=" + winHeight+",top="+y+",left="+x+"'" + otherFeatures
   var NewWindow = window.open(theURL,winName,features);
   NewWindow.focus();
}
// -->
</script>

Then make your link look like this:

<a href="media/staff.htm"
    target="newWindow"

onclick="popWindow(this.href,this.target,'300','300','scrollbars=no,resizable=no')
; return false;"
    title="Meet the Staff">Meet the Staff</a>

(if anybody spots any errors please point them out! :-)

I hope that helps,
Cheers,


--
Olly Hodgson
http://planetgnarly.com/



More information about the thelist mailing list