compuhelpindia.com

Javascript Introducation

Compuhelpindia.com
« Previous                                                                                                                                     Next Chapter »


JavaScript is the most popular programming language.
This language is used for HTML, for the web, for servers, PCs, laptops, tablets, phones, and more.

JavaScript is a Scripting Language

A scripting language is a lightweight programming language.
JavaScript is programming code that can be inserted into HTML pages.
JavaScript code can be executed by all modern web browsers.
JavaScript is easy to learn.

JavaScript: Writing Into HTML Output

<!DOCTYPE html>
<html>
<body>
<h1>My First JavaScript</h1>
<p>This is paragraph.</p>
</body>
</html>

My First JavaScript

This is paragraph.



JavaScript: Changing HTML Content

JavaScriptis commonly used to manipulate the content of HTML elements.
<p id="hello">
JavaScript can change the content of an HTML element.
</p>
<script>
function myFunction()
{
x=document.getElementById("hello");  
x.innerHTML="Hello JavaScript!";  
}
</script>
<button type="button" onclick="myFunction()">Click </button>

JavaScript can change the content of an HTML element.