VirtualMV/JavaScript/Starting/First JS

From WikiEducator
Jump to: navigation, search



VmvIcon Objectives.png

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

First JavaScript

In this example we will create a Web page that includes JavaScript to display Hello world.. JavasScript rulz!. Just to show how HTML and JavaScript integrate I have included a div tag that changes the text colour to blue and in the JavaScript told the text to display as h1 (heading 1).

JavaScript (js1_01)

<div style="color: #0000FF">
<script type="text/javascript"><!-- document.write('<h1>Hello world.. JavaScript rulz!</h1>');//--></script></div>

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/Starting/First JS. (2022). In WikiEducator/VirtualMV wiki. Retrieved August 12, 2022, from http:    (zotero)