Java Script tutorial Part one.

JavaScript is a text-based programming language used 

Both on the client-side and server-side that allows you to make web pages very attractively.

Also JavaScript is the world’s most popular programming language.

Where we can use for JavaScript.

JavaScript is mainly used for making the

web applications and web browsers.

Adding interactive features to the web sites as follows,

  • Displaying a timer or count-down on a website.
  • Playing audio and video in a web page.
  • Making animations.
  • Using a drop-down hamburger menu.
  • Show or hide more information with the click of a button options.
  • Change the color of a button when the mouse hovers over it.
  • Slide through the of images on the homepage.
  • Zooming in or zooming out on an image.

Greeting web and mobile apps.

Creating web servers or web base applications.

Game development.

JS have method that is using many time in the code.

The method is getElementById()

In this code demo is a id and change the innerHTML “Hello Javascript” can change using  javascript.

JavaScript code is inserted between <script> </script> tag.

We can place the script between the <head> tag or <body> tag.

Normally, Javascript function is put inside the <head> tags.

<!DOCTYPE html>
<html>
<head>
<script>
function myFunction() {
  document.getElementById("demo").innerHTML = "Paragraph changed.";
}
</script>
</head>
<body>
<h2>Demo JavaScript in Head</h2>

<p id="demo">A Paragraph</p>
<button type="button" onclick="myFunction()">Try it</button>
</body>
</html>

We can display JS using bellow ways,

  • HTML element, using innerHTML.
  • output of the html writing using document.write().
  • Writing into an alert box, using window.alert().
  • Writing into the browser console, using console.log().

document.getElementById(id) – Using this we can access HTML element.

innerHTML property of an HTML element is a common way to display data in HTML.

document.write() – Delete the all existing HTML.

console.log () – This is using to display the data in the browser.

window.print() – Print the content in the current window.

window.alert() – Display the alert box.

PHP Tutorial Part one.

Leave a Reply

Your email address will not be published. Required fields are marked *