onclick function go to url code example
Example 1: onclick url
<button onclick="location.href='logout.php';">logout</button>
Example 2: onclick open link js
window.open(url);
<button onclick="location.href='logout.php';">logout</button>
window.open(url);