VirtualMV/JavaScript/Starting/First JS

From WikiEducator
Jump to: navigation, search




Introduction

Overview

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)

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

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. (2017). In WikiEducator/VirtualMV wiki. Retrieved October 22, 2017, from http://wikieducator.org/VirtualMV/JavaScript/Starting/First_JS    (zotero)