Google News
logo
Internal Javascript
Internal JavaScript : JavaScript code is placed in the head and body section of an HTML page. 
Example :
<html>
<head>
<title>Internal JavaScript</title>

<script type="text/javascript">
  document.write("This is Internal Javascript Example.!!!");
</script>

</head>
<body>
 
 
</body>
</html>
Output :
External Javascript
External Javascript : JavaScript code are stored in separate external file using the .js extension (Ex: external.js).

In the HTML file, the <script> tag can also be used to indicate the location of a JavaScript file. The src attribute is assigned the path and filename of the file.
external.js
document.write("This is External Javascript Example.!!!");
Example :
<html>
<head>
<title>External JavaScript</title>
 <script type="text/javascript" src="external.js"></script>
</head>
<body>
 
 
</body>
</html>
Output :