• How to make a script?

    A script is a special component written in one of the programming languages ​​that is embedded in the HTML code, responsible for running scripts on the server or client side. As a rule, a script that interacts with the server part is written to facilitate and speed up the processing of large streams of information, and the user script is responsible for processing the data received from the user as a result of an action by him. Most often, as such an action that executes a particular script, is a click.

    Scripts can reduce the time for organizing and executing complex site functionality and simplify working with various administration systems, since using them you can replace the duplicate components of the code with one commented out snippet. Scripting is possible in all existing programming languages. In this article we will explain how to make a script in VBScript, JavaScript and PHP.

    Vbscript

    Visual Basic Scripting Edition (VBScript) is one of the most common programming languages ​​created by Microsoft specifically for scripting. It is a type of Visual Basic language.

    An example of the simplest script in VBScript:

    • 'A "Hello, World!" program
    • Module Hello
    • Sub Main ()
    • MsgBox ("Hello, World!")
    • End sub
    • End Module

    Explanation:

    • The first line is a comment to the script. Anything behind the 'compiler will not recognize. This text is for your convenience only.
    • Further, any script in VBScript must contain the Main procedure, which is the starting point of the program and controls the operation of the application.
    • The Main procedure calls the MsgBox function, which displays a dialog box with any textual content.

    To run the script via the command line, you must do the following:

    1. Create a text source document and save it with the Hello.vb extension.
    2. Enter the vbc Hello.vb command.
    3. The compiler will create a Hello.exe file.
    4. To run the program, enter the Hello command.

    Javascript

    The programming language JavaScript is most often used to create Web pages. In scripting in JavaScript, the <script> tag is crucial, after which the executable code is placed.

    • <! DOCTYPE HTML>
    • <html>
    • <head>
    • <meta charset="utf-8">
    • </head>
    • <body>
    • <p>Начало документа...</p>
    • <script>
    • alert ('Hello world!');
    • </script>
    • <p>... Конец документа</p>
    • </body>
    • </html>

    When the browser sees this tag, it switches to JavaScript mode and executes its contents. After the end of the script and the </ script> tag, the browser switches back to the HTML mode.

    Php

    PHP programming language is used to generate HTML pages on a web server and work with databases. The PHP script looks like this:

    • <html>
    • <head>
    • <title>Текст PHP</title>
    • </head>
    • <body>
    • <? php echo '<p>Hello world!</p>'; ?>
    • </body>
    • </html>

    The file with the script code must be placed in the root directory of the web server. To run it, you first need to enter in the browser the name of the web server you are using and the name of the file with the .php extension.


    Related news


    How to raise the foundation of the house
    What should be the president
    What dream acquaintance
    What ended Karpov
    How to make a flashlight
    A hammock with your own hands is just
    How to raise self-esteem
    What are the fish