linking button to a url on onclick event in html code example Example: onclick url <button onclick="location.href='logout.php';">logout</button>