How to Use JavaScript
- 1). Open your web page development software or text editor.
- 2). Start a blank web page with the required DOCTYPE, HTML, Head, and BODY HTML tags in the document.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>My First Javascript Web Page</title>
</head>
<body>
</body>
</html> - 3). Enter a script opening and closing tag in the HTML document body.
<script type="text/javascript">
</script> - 4). Modify text. Javascript allows you to modify the text written on the HTML page through using the document.write() method. In between the opening and closing script tags, input a document.write method call with a message to the viewer. In this example, we state "Hello World."
<script type="text/javascript">
document.write('Hello World!');
</script> - 5). Save the web page and view it in your web browser.
Source...