Instruction
1
Code can be inserted into the page in the body of the document <body> and in the <head> section. To add active content, you can use an unlimited number of items. Importantly, added the scripts do not interfere with the display of the main content. To edit HTML code, open your page in any text editor. Webmasters often use programs with functional lighting used handles: Notepad++, Web Development Studio, HTML Reader. The necessary file can also be opened with a standard Notepad of Windows operating system.
2
In the text editor enter HTML code. For example, to insert JavaScript into the page, use the following command:

<script type = “text/javascript”> Code to execute </script>

The code will be executed when the page is loaded and will be executed within the handle <script>. In this case the type parameter gives the handler to understand what you will use the programming language JavaScript.
3
In order for the script has processed a certain event, for example, when the button is pressed, you must insert it inside the function. In section <head> </head> enter the script code:

<script type = “text/javascript”>
Function displayDate()
{ document.getElementById(“perform”).innerHTML=Date(); }
</script>

This JavaScript code is responsible for displaying the current time on the page, however, for its display, you must enter an additional command processing generated in the process of the text.
4
In the body of the document <body> in HTML create a button, which will be responsible for the activation of the element:

<p id = “perform”></p>
<button type = ”button” onclick = ”displayDate()”>Show time</button>

This code creates a button and the JavaScript engine. After clicking it will display the result of the script.
5
To include external HTML in the program-script in a particular file, execute the following code:

<script type = ”text/javascript” src = ”file.js”></script>

After running the specified script file.js will be included in the page. It is worth noting that to successfully add an external file should not contain <script></script>.