blob: 2bd7613d26d01bb8d70f168884758f3b9502bfea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
<!doctype html>
<script>
function openWindow(id) {
window.childWindow = window.open(location.href + "?" + id, "", "");
}
</script>
<button id="open-click" onclick="openWindow('open-click')">Open window</button>
<button id="focus" onclick="window.childWindow.focus()">Focus window</button>
<button id="open-mousedown">Open window</button>
<script>
document.getElementById("open-mousedown").addEventListener("mousedown", function(e) {
openWindow(this.id);
e.preventDefault();
});
</script>
|