They are Internal and external. While Internal scripts are written within the header of an HTML file, external scripts are saved in a separate file with extension js. They are then linked in an HTML document with the <script> tag’s src attribute. For example, if the file Myscript.js contains your codes, then it can be linked as follows:
Hello World program
You can output to the browser document by using the statement given below:document.write("Put your text here")
Using Prompt() and Alert() dialog boxes
<input type = "submit" value = "Click here to close"
onClick = "ok()"></BODY></HTML>
Likewise, if you apply window.print() the current page will be printed provided user’s printer is not idle.