VirtualMV/JavaScript/JS and HTML

From WikiEducator
Jump to: navigation, search



VmvIcon Objectives.png

By the end of this page you will be able to:

  • Understand how JavaScript and HTML are related

JavaScript and HTML

  • When a JavaScript is inserted into an HTML document, the Internet browser will read the HTML and interpret the JavaScript. The JavaScript can be executed immediately, or at a later event, depending how and where it is placed.
  • To add JavaScript to an HTML page enclose code between
<script type="text/javascript">
  • Note. You may find <script language ="Javascript"> in code you see on the Internet. The language attribute has been deprecated so avoid using it in your code.
  • Example HTML page with JavaScript
    <script type="text/javascript">      <!--       document.write('<h1>Hello world.. JavaScript rulz!</h1>');    //-->    </script>  </body>

Example : Click here to run js1_01. The diagram following shows the result in Google's chrome.

JavaScript: Hello World (in Google's Chrome Web Browser)

VmvIcon References.png References

virtualMV  |  Superquick wiki guide  |  Please give me some feedback

VirtualMV/JavaScript/JS and HTML. (2022). In WikiEducator/VirtualMV wiki. Retrieved August 12, 2022, from http:    (zotero)