How to Print a Message With Javascript
JavaScript is a Web scripting language used to provide client-side functionality such as form validation and user messages. There are many ways in which JavaScript can help you with the development of your website. You can use JavaScript to print a message to your Web page or via an alert window.
Instructions
-
Web page message.
-
1
Create a new file and save it as "myPageTest.html."
-
2
Insert the following into the file:
<html>
<body>
<script >
document.write("A test JavaScript Message.");
</script>
</body>
</html>
-
-
3
Save the file and test it by double-clicking on it. The message should appear on your Web page.
Alert window.
-
4
Create a new file and save it as "myAlertTest.html."
-
5
Insert the following into the file:
<html>
<body>
<script >
alert("A test JavaScript Message.");
</script>
</body>
</html>
-
6
Save the file and test it by double-clicking on it. The message will appear in an alert window.
-
1
References
- Photo Credit keyboard image by Fyerne from Fotolia.com