• How to insert a script?

    Elena Melnichenko
    Elena Melnichenko
    May 2, 2015
    How to insert a script?

    A script is a program file, but more specifically, it is almost any executable procedure that is written in a programming language and is loaded for the server to execute a request that came from a certain Internet page. Scripts are used in many areas related to programming and web resources. For novice programmers, it may not be clear how to insert a script.

    Adding Scripts

    Usually, scripts that are inserted into the pages of Internet sites are written in several programming languages. Here are the most common ones:

    • Javascript;
    • PHP

    Javascript

    JavaScript is a script that runs directly in the browser itself, but not on the server. This script is called "client". Where to embed the scripts of this language? To connect a script that is a separate file with the js extension, you need to connect it to the page by adding the header part of the html code (the part starting with <HEAD> and ending in </ HEAD>) along with the link to this file.

    JavaScript scripts can also be inserted into the <body> sections of the html page.Understanding how to insert the script in html will help the final </ HEAD> tag, if you find it and insert your script in front of it, then you will not make any mistakes. Before him you can put a link to the script file Java <script type = "text / javascript" src = "script.js"> </ script>. In place of the value of script.js, you need to insert the name of your own js file. This file should be located in the same folder as the page itself - then the server will read it without any problems.

    Php

    If we talk about the PHP scripting language, this is a script that runs not in the browser, but in the server itself, which is why it is called “server-side”. As in the previous version, if you have this script in a separate file, then you simply add a link to it in the page code. An example of how a link may look will help you understand how to insert a script on a website of a given language. Here is its possible form: <? php include "script.php"; ?>. In the place of script.php you insert the name of your file. This code must be inserted at the beginning of the page, in front of all the tags standing there. Also, be sure to ensure that there are no lines and spaces before the PHP code you insert. If you use the service scripts incorrectly, the files on your site will become damaged.

    Whatever the script, service or client, to paste it into the page, you need to upload the file to the server itself, using an FTP client. Download should be done directly through the browser.


    Related news


    What is goiter
    Increases or decreases the pressure of the carcade
    Where to buy a pistol Peter, Moscow
    Backgrounds for your creativity
    How to choose karaoke
    When an indirect heart massage is indicated
    Hepatrombin C: instructions for use, indications, price
    How to check a webcam