Javascript Tutorial
Javascript starts with
If we want to show something on the website in Javascript we have to write
So the full script to show something on the website is
Here is the screenshot of website after writing above code
We can also show something on the website by the following javascript code document.getElementById("idName").innerHTML = "Text to show on the website";
Here is the screenshot of the browser after writing above code
Now lets create a function with above code.
Function is a block of code then can be called by event like by clicking a button.
We will create a function and will call it by click.
To create a function we will have to write function functionName() {code}
To call function we will have to write onclick="funcionName()"
Here is the screenshot of the browser after writing above code
After clicking the button the text showsWe can put the javascript code in the head of HTML documents.
In this example we will put the function in the head and call the function in the body by clicking button.