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. (2024). In WikiEducator/VirtualMV wiki. Retrieved November 5, 2024, from http:https://wikieducator.org/VirtualMV/JavaScript/Starting/First_JS    (zotero)