The JavaScript is used in web programming to extend HTML commands and give more flexibility and additional options to solve complicated web page solutions. JavaScript is part of HTML code, but it is not HTML. Read more about HTML on this link.
The first Online Tech Support example shows only a “pure” HTML source without any JavaScript objects.
<html> <body> <h2>My Web Page</h2> </body> </html>
You can try this JavaScript If example on this link.
The second JavaScript tutorial example is with the same HTML code above but with additional JavaScript output text that says “Hello JavaScript!” This is your first HTML page using JavaScript method and it writes on the screen. The JavaScript is defined between the script tags that give you an sign that this is not any more just HTML code. To write on screen we are using method write and it applies to object document. The “Hello JavaScript!” text contains both side the p-tags (paragraph) that do belong to HTML but would make the output text look better on a browser screen.
<html> <body> <h2>My Web Page</h2> <script type="text/javascript"> document.write("<p>Hello JavaScript!</p>"); </script> </body> </html>
You can try this JavaScript If example on this link.
Now take a look at our other example on the main screen to try out more JavaScript methods.
See Also:
Home