". 2. Reference js files in JavaScript code with the syntax "script tag object.src = "file path";"."/> ". 2. Reference js files in JavaScript code with the syntax "script tag object.src = "file path";".">

Home>Article>Web Front-end> How to introduce js files into html

How to introduce js files into html

醉折花枝作酒筹
醉折花枝作酒筹 Original
2021-04-12 18:07:48 85429browse

Two import methods: 1. Use the src attribute of the script tag to import the js file, the syntax is "6fe72667dc91a8b20b2098e5c999b5c02cacc6d41bbb37262a98f745aa00fbf0". 2. Reference js files in JavaScript code with the syntax "script tag object.src = "file path";".

The operating environment of this tutorial: windows7 system, javascript1.8.5&&HTML5 version, Dell G3 computer.

js file refers to a text file that stores JavaScript code, with the suffix name ".js".

So how to introduce js files in html, there are the following two methods:

The first one: use the src attribute of the script tag to introduce js files

//(相对路径) //(绝对路径)

Second type:Referencing external js in JavaScript code

Recommended learning:html video tutorial

The above is the detailed content of How to introduce js files into html. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn