I'm having some trouble in trying to get my JS file to work with my HTML file, or at least I think that's the problem. When I run my website, it doesn't change the text to the new text when I click the buttons...
here's the Js file:
var page = document.getElementById('pageContainer');
function homepage() {
page.innerHTML = '<p>This is the main page of the site!</p>';
}
function contactpage() {
page.innerHTML = '<p>This is the contact page of the site!</p>';
}
function aboutpage() {
page.innerHTML = '<p>This is the about page of the site!</p>';
}
here's the HTML file:
<html>
<head>
<script src="script.js" type="text/javascript" ></script>
<link rel="stylesheet" href="style.css">
<title>alphaEncryption's Website!</title>
</head>
<body>
<h1>Welcome to the website!</h1>
<h2>have a look around!</h2>
<button id='home' onclick='homepage()'>Home</button>
<button id='contact' onclick='contactpage()'>Contact</button>
<button id='about' onclick='aboutpage()'>About</button>
<div id='pageContainer'>
<p id='page'>This is the main page of the site!</p>
</div>
</body>
</html>