JAVASCRIPT/JQUERY
I need to write code that involves 2 html pages, page 1 needs abutton that once clicked, it displays page2. On page 2 there needsto be a go back button to go back to page1. Here is my code forpage 1. The page names are page1 and page2
<h1>This is page 1</h1>
<input type = “button” id=”page2″ value= “Go to page2”>
<script>
Location = “page1.html”;
$( “#page2” ).click(function() {
location.replace = “page2.html” ;
});
</script>
Answer
Page1.html
<!DOCTYPE html>
<html>
<head>
<title>Page 1</title>
</head>
<body>
<h1>This is page 1</h1>
<input type = “button” id=”page2″ value= “Go to page 2″onclick=”pageRedirect()”>
<script>
function pageRedirect() {
window.location.replace(“page2.html”);
}
</script>
</body>
</html>
page2.html
<!DOCTYPE html>
<html>
<head>
<title>Page 2</title>
</head>
<body>
<h1>This is page 2</h1>
<input type = “button” id=”page2″ value= “Go to page 1″onclick=”pageRedirect()”>
<script>
function