Book
Submodule 5.2: Simple JavaScript file
Submodule 5.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 ''yourNameWEB2JS" as example05.2.02.html
". Next, open the file (Ctrl+O
) in your Chrome.