Javascript Browser location redirect to another web page via button click

Description

Javascript Browser location redirect to another web page via button click

View in separate window

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JavaScript Page Redirect onclick Event</title>
<script>
    function pageRedirect() {//from  w w  w.  j av a  2 s .co  m
      window.location.href = "http://java2s.com/";
    }
</script>
</head>
<body>
    <button type="button" onclick="pageRedirect()">Go to Tutorial</button>
</body>
</html>



PreviousNext

Related