Book
Submodule 6.2: Simple JavaScript file
Submodule 6.2: Simple JavaScript file
Completion requirements
View
- JavaScript in HTML file
- alert interaction
- Variables
- prompt interaction
- Comments in JavaScript
- Developer tools (console)
The "alert" JavaScript file
We will put our code on the head of the HTML file:
It is the simple interaction "alert
".
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example of alert()</title>
<script>
alert("Hello world");
</script>
</head>
<body>
</body>
</html>
Copy and paste the code into your editor to see the output. Save the file in the folder "temporaryFiles
". Next, use the the Live preview in the editor or open the file (Ctrl+O
) in your Chrome.