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

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

王林
王林forward
2020-09-15 17:42:413644browse

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>

Method 2 :Write JS code in the body tag

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

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!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete