I've written a simple CSS stylesheet that is meant to alter a page's background colour however, I'm having trouble calling it via Javascript through my HTML file. I know how to alter the background of an HTML file using Javascript, but the problem is that I don't know how to call on a stylesheet to alter the HTML file. Here's my code:
HTML
<html>
<body>
<p id="p1">Altering style of first paragraph via Javascript.</p>
<p id="p2">Altering style of second paragraph via Javascript.</p>
<script>
document.getElementById("p1").style.color = "green";
var p2 = document.getElementById("p2");
p2.setAttribute("style", "font-size: 20px;");
</script>
</body>
</html>
Stylesheet
body {
background-color: green;
}