You will have to separate the javascript from the markup. That's a common best practice for developing in HTML/Javascript. I've put an example in jsfiddle:
HTML:
<h1>New Window properties</h1>
<div>
<label for="windowWidth">Width:</label><br />
<input id="windowWidth" type="number" value="200" />
</div>
<div>
<label for="windowHeight">Height:</label><br />
<input id="windowHeight" type="number" value="200" />
</div>
<div>
<input id="newWindow" type="button" value="Open New Window" />
</div>
Javascript:
var newWindowButton, // Reference to the button we can click on
newWindowWidth, // We can provide a width for the new window, defaults to 200 px
newWindowHeight; // We can provide a height for the new window, defaults to 200 px
newWindowButton = document.getElementById('newWindow');
newWindowButton.onclick = function () {
var newWindowUrl,
newWindowName,
newWindowOptions;
newWindowWidth = document.getElementById('windowWidth').value;
newWindowHeight = document.getElementById('windowHeight').value;
newWindowUrl = '';
newWindowName = 'NewWin';
newWindowOptions = 'toolbar=no,status=no,width='+newWindowWidth+',height='+newWindowHeight;
window.open(newWindowUrl, newWindowName, newWindowOptions);
};
http://jsfiddle.net/yg9jeyza/2/