CodesJava

Easy learning with example program codes

javascript example programs code


Before starting an example let us discuss how JavaScript can display the data.

JavaScript ways of data display:

1. window.alert(): Display data into an alert box.
2. document.write(): Display data into the HTML output.
3. innerHTML: Display data into an HTML element.
4. console.log(): Display data into the browser console.

Javascript in head tag example:

<html>  
<head>  
<script type="text/javascript">  
  alert("Hello codesjava.com");  
</script>  
</head>   
</html>

Try it:

JS Bin on jsbin.com

Javascript in body tag example:

<html>  
<body>  
<script type="text/javascript">  
  alert("Hello codesjava.com");  
</script>  
</body>   
</html>

Try it:

JS Bin on jsbin.com

Javascript in head and body tag example:

<html>  
<head>  
<script type="text/javascript">  
function sayHello(){  
 alert("Hello codesjava.com");
}  
</script>  
</head>  
<body>  
<p>Hello World Javascript Example.</p>  
<form>  
<input type="button" value="Say Hello" onclick="sayHello()"/>  
</form>  
</body>  
</html>

Try it:

JS Bin on jsbin.com
 



Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at hr@codesjava.com.

Development

We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on hr@codesjava.com.

Copyright © 2019 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki