I am trying to make a button that will popup a new window using a javascript button pressed by the user. The button shows up on the site, but nothing happens when I press it. I've tried it in Chrome and Firefox. I can't figure out if it's browser settings or code error.
<button onclick="window()">Reminisce</button>
<script type="text/javascript">
function window() {
var w = window.innerWidth;
var h = window.innerHeight;
var rw = Math.random()*w)+1);
var rh = Math.random()*h)+1);
var popup = window.open('http://www.roberthayeskee.com/bush2.html,'_blank','width=rw,height=rh');
}
</script>
Thanks!
In addition to TimoSta's answer, your code is full of syntax errors and typos. You probably want something along the lines of:
https://jsfiddle.net/hsfcc8sp/4/
function openWindow() {
var w = window.innerWidth;
var h = window.innerHeight;
var rw = Math.random()*w+1;
var rh = Math.random()*h+1;
var popup = window.open('http://www.roberthayeskee.com/bush2.html','_blank','width=' + rw,'height=' + rh);
}
But I had to change a lot of code...