How do I open a window on a different screen?

http://stackoverflow.com/questions/5457034

by Marcel

HTML

<h1>Pop-up window in other monitor</h1>
<p><input type="button" value="Pop-up &amp; out"></p>
<p>This screen's resolution is <span id="res"></span>.</p>

CSS

body { text-align:center; font:13px/1.4 'segoe ui', sans-serif; }
h1 { margin:.5em 0 1em; letter-spacing:-.05em; font:700 2em/1.2 'myriad pro', sans-serif; }
p { margin:0 0 1em; }
#res { color:green; }
input[type=button] { padding:.15em 1em; }

JavaScript

$("input:button").click(function() {
    pop_l = window.open('', 'popl',
        'height=150,width=400,top=200,left=-500');
    pop_r = window.open('', 'popr',
        'height=150,width=400,top=200,left='+(screen.width+500));
    pop_l.document.write(pustr("left"));
    pop_r.document.write(pustr("right"));
});
window.setInterval(screenres, 1000);

function screenres(){
    $("#res").html(screen.width+'&times;'+screen.height);
}

function pustr(dir) {
    return "\
        <style>body { padding:3em; text-align:center; font:13px/1.4 sans-serif; }</style>\
        I tried to break 500px offscreen <br>to the <b>"+dir+"</b>, any good?";
}