Forum Moderators: open
function popup(url,wname,w,h)
{
newwin = window.open('',wname,'width=' + w + ',height=' + h);
}
<a href='http://www.domain.com/page.htm' target="popup" onclick="popup('http://www.domain.com/page.htm', 'popup', 500, 300);">Click to popup</a>
Nothing more annoying than a window that doesn't fit the monitor, you might want to add resizable too.
<a href='http://www.domain.com/page.htm' target="popup" onclick="popup('http://www.domain.com/page.htm', 'popup', 500, 300);">Click to popup</a>
You may want to do something else for the window name. If all calls to this function pass "popup" as the name, if the user doesn't close the window any new content will appear in that window. If the new window is behind the main window, The user clicks and it appears "nothing happens."
This uses a time variable to generate a unique name for every window and insures it always comes up with a new window:
function popup(url,w,h)
{
var day = new Date();
var id = day.getTime();
newwin = open(url,id,'width=' + w + ',height=' + h+',scrollbars,resizable');
}
Also you have '' in your example for the url.