As part of a very basic introduction to programming I am instructed to make a simple HTML file with the following code:
<html>
<head>
<title>Simple Page</title>
</head>
<body>
<p>This is a very simple HTML page</p>
<script src="script.js"</script>
</body>
The file is saved as container.html
In the same folder is a file called script.js which contains the following:
alert(“Hello World”);
When I load the HTML file into Safari 7.0.2 it correctly displays "this is a very simple HTML page" and appears to load something but the Javascript alert "Hello World" does not appear in a pop up style window as it does on the instructors computer.
I have checked all settings to make sure Javascript is enabled and popup blocker is off. I've also tried loading in Firefox and Crome but it does not work correctly.
As instructed in the course I am coding using TextEdit and viewing the script through the container.html file.
You made a mistake
<html>
<head>
<title>Simple Page</title>
</head>
<body>
<p>This is a very simple HTML page</p>
<script src="script.js"></script>
</body>
</html>
You forgot the closing tag on the script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With