2022.4.10 js三种引入方式
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Title</title> 6 7 <!--内部引入 在script标签中中写js代码--> 8 <script> 9 <!-- 弹窗--> 10 alert("hello world"); 11 </script> 12 13 <!-- 外部引入--> 14 <script src="js/test1.js"></script> 15 <!--不用显示定义type,默认为js--> 16 <script type="text/javascript"></script> 17 18 </head> 19 <body> 20 21 <!--script标签也可以写到这里--> 22 </body> 23 </html>
js文件;
1 alert("hello world");


浙公网安备 33010602011771号