Javascript is an object based scripting language. Javascript is lightweight and cross platform.It is a programming language for HTML and web.
JavaScript is used to create interactive websites. It is mainly used for:
Basically JS can change the HTML content and below is one example.
document.getElementById("example").innerHTML = "Hello JavaScript";
This example uses the method to "find" an HTML element (with id="example"), and changes the element content (innerHTML) to "Hello JavaScript"
Javascript Example:
Output:
Hello JavaScript - First example
JavaScript is used to create interactive websites. It is mainly used for:
- Client-side validation
- Dynamic drop-down menus
- Displaying data and time
- Displaying popup windows and dialog boxes etc
Basically JS can change the HTML content and below is one example.
document.getElementById("example").innerHTML = "Hello JavaScript";
This example uses the method to "find" an HTML element (with id="example"), and changes the element content (innerHTML) to "Hello JavaScript"
Javascript Example:
<h2>Welcome to JavaScript</h2>
<script>
document.write("Hello JavaScript - First example");
</script>
<script>
document.write("Hello JavaScript - First example");
</script>
Output:
Hello JavaScript - First example