How to insert a script?

script - a program file, but more specifically, it is almost any procedure performed, which is written in a programming language, and is loaded to perform the query server that came with the specific web page.Scripts are used in many fields related to programming and web resources.For novice programmers may be unclear how to insert script.

Adding scripts

usually scripts, which are inserted on the website pages, are written in multiple programming languages.Here are the most common ones:

  • JavaScript;
  • PHP.


JavaScript - a script that runs directly in the browser, but not on the server.This script is called a "client."To embed scripts that language?To connect the script, which is a separate file with the extension of the js, it must be connected to the page with the title of the code html (the part starting with & lt; HEAD & gt; and ending in & lt; / HEAD & gt;), together with a link to this file.

JavaScript scripts can also be inserted in the section & lt;body & gt;on html page.Understand how to insert script into html, help end tag & lt; / HEAD & gt ;, if you find him, and before him insert his script, the error is not exactly admit.Before it is possible to put a link to a Java script file & lt;script type = "text / javascript" src = "script js." & gt; & lt; / script & gt ;.In place of the values ​​of script.js need to insert the name of your own js file.This file should be you in the same folder as the page itself - then no problem server will read it.


If we talk about the language of PHP scripts, this script is not running in the browser, and the server itself, so it is called the "server."As in the previous version, if you have this script in a separate file, you simply add code pages link to it.Understand how to insert a script on the website of the language, helps example, might look like a link.Here it possible form: & lt ;?php include "script php.";? & Gt ;.In place script.php you insert the name of your file.This code must be inserted at the beginning of the page before all tags standing there.In addition, always make sure that before you insert PHP code there are no lines and spaces.If you are using the wrong service scripts, the files on your site will be damaged.

Whatever the script, service, or client to paste it on the page, you need to upload a file on the server itself, using the FTP client.Loading must take place directly through the browser.

In addition, a proper installation scripts can be found in the article How to install scripts.