You're missing parentheses on the
stockButton
call. Aside from that, I can't see anything obviously wrong with your code.
However, you can simplify things with event delegation:
<!--
<div id="controls">
<button title="Go Home" data-url="https://www.duckduckgo.com">Home</button>
<button id="print_button">Print</button>
<button data-url="https://www.google.com/">Google</button>
<button data-url="https://www.cnbc.com/pre-markets/">Check Pre-Market Stocks</button>
</div>
<!--
<!--
<webview
id="webview"
autosize="on"
src="https://media.istockphoto.com/photos/analyzing-samples-in-test-tube-backgrounds-picture-id1290116527?s=612x612"
></webview>
document.addEventListener("DOMContentLoaded", () => {
calculateLayoutSize();
document.getElementById("controls").addEventListener("click", e => {
const button = e.target;
const url = button.dataset.url;
if (!url) { return; }
console.debug("Navigate to", url);
document.getElementById("webview").src = url;
});
});