Opening popups from links via javascript

When using a link to open a popup window, to keep the main window from repositioning, use following:

<a href=”#” onclick=’window.open(“somecgi.pl?someargs”,””,”width=###,height=###,top=##,left=##,scrollbars”,””,””); return false’>Click Me!</a>

The key is the “return false” following the window.open() to prevent the link from doing anything.

Advertisements

Feel Free to Comment (Name/Email/Website optional):

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: