JavaScript Examples

JavaScript is an Interpreted Language, mainly used for Client side(Browser) validation, and to perform dynamic operations(like add a row to table, when button is clicked,etc…) on webpage.

Disadvantages of JavaScript

Javascript can be disabled by User, hence cannot completely rely on Javascript
File I/O, Multi threading… not supported

JavaScript can be embedded into html page, by using below<script> tag
<script language=”javascript” type=”text/javascript”>
//JavaScript code here
</script>

<html>
<body>
<script language=”javascript” type=”text/javascript”>
document.write (“Hello World!”)
</script>
</body>
</html>

JavaScript can be written in a separate file with .js extension. And this .js file can be included in any number of HTML files.

In this case same JavaScript file, can be included in multiple HTML files.

javascript Simple example
javascript external file
validate number
JavaScript to validate simple form
JavaScript to send parameters
onmouseover
JavaScript onblur example
JavaScript to dynamically add rows to an HTML table
change button text using JavaScript
change button text using JavaScript
table_add_rows