I am attempting to design a webpage where one page can influence the content of another page. I have two HTML pages and a JavaScript file named "Controll.js" which contains a function that changes the content of "Indiv" in Index.html. This function is triggered by a button on Controll.html. Here is my code:
function myFunction() {
document.getElementById("Indiv").innerHTML = "Hi!!";
}
<!-- Controll.html -->
<!DOCTYPE html>
<head>
</head>
<body>
<button type="button" onclick="myFunction()">write hi</button>
</body>
<script src="Controll.js"></script>
</html>
<!-- END Controll.html -->
<!-- Index.html -->
<!DOCTYPE html>
<head>
<script src="Controll.js"></script>
</head>
<body>
<p id="Indiv"></p>
</body>
</html>
<!-- END Index.html -->