Home > Web Front-end > HTML Tutorial > What method can be used to add js to the html page?

What method can be used to add js to the html page?

王林
Release: 2020-09-15 17:42:41
forward
3685 people have browsed it

What method can be used to add js to the html page?

Method 1: Introduce JS files in the head tag

(Recommended tutorial: html tutorial)

<html>
    <head>
        <script src="此处写你的js文件路径"></script>
    </head>
    <body>
 
    </body>
</html>
Copy after login

Method 2 :Write JS code in the body tag

<html>
    <head>
 
    </head>
    <body>
        <script type="text/javascript">
            //在这里面写你的js代码
        </script>
    </body>
</html
Copy after login

The above is the detailed content of What method can be used to add js to the html page?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template