Java script tutorial



 

Examples

My First JavaScript


<button type="button"onclick="document.getElementById('demo').innerHTML = Date()">
Click me to display Date and Time.</button>
<p id="demo"></p>

Why Study of JavaScript?

JavaScript is one of the  languages which all website developers must learn:

   1. HTML to define the content of web pages.

   2. CSS to specify the layout of web pages.

   3. JavaScript to program the behavior of web pages.


Js introduction

JavaScript Can also Change HTML Content

One of many JavaScript HTML methods is getElementById().

example below "finds" an HTML element (with id="demo"), and changes the element content (innerHTML) to "Hello JavaScript":


Example

What Can JavaScript Do?

JavaScript can change HTML content.



code is here


<h2>What Can JavaScript Do?</h2>
<p id="demo">JavaScript can change HTML content.</p>
<button type="button" onclick='document.getElementById("demo").innerHTML = "Hello JavaScript!"'>Click Me!</button>

Post a Comment

0 Comments