How To Connect A Script

Table of contents:

How To Connect A Script
How To Connect A Script

Video: How To Connect A Script

Video: How To Connect A Script
Video: [Fast Connect]Скрипт для быстрого подключения на полный сервер 2024, May
Anonim

A script is a special program that organizes one of the site's services or performs useful functions for it. For example, a script can interact with a database. It is also used to submit information from various registration forms.

How to connect a script
How to connect a script

Necessary

  • - computer;
  • - html layout skills.

Instructions

Step 1

Connect the script directly to the html file. To do this, write a tag in the body of the page, and enter script commands in it. First of all, when the browser reads the page, it recognizes the script. The browser reads it and executes the written code, and only then continues reading the page.

Step 2

So, to insert a script type, use the Type attribute, after it, put an equal sign and enter the script type. Next, you can add a For construct, a Var declaration (sets a local variable), and an Alert function to display a message.

Step 3

Take out the java script in the page header. Usually, site authors try to separate the script from the document / web page. To do this, place the script code in the Head tag, and leave a clean layout in the body of the page. Be sure to include both the opening and closing script tags (and thus). When pasting the code, keep in mind that uppercase and lowercase letters are different, so be careful when copying codes from various Java script examples.

Step 4

Include a separate file with the content of the script, and include it in the web page, then the javascript code is not written in Html. Only a link to the file is inserted into the body of the page, for example. In the java script file itself, enter the required code that you would insert into the body of the page, as, for example, in the first step.

Step 5

Use this Javascript option when you need to connect the same script to different pages. If the browser is configured correctly, then it will cache it and will not download it from the server every time. To connect multiple scripts, write the tag as many times as needed. If you specify the src attribute, then the contents of the script tag will be ignored.

Recommended: