Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Page Redirect onclick Event</title> <script> function pageRedirect() { window.location.href = "https://www.tutorialrepublic.com/"; } </script> </head> <body> <button type="button" onclick="pageRedirect()">Go to Tutorial Republic</button> <p><strong>Note:</strong> You can go to the tutorialrepublic.com by clicking the button above.</p> </body> </html>