javascritpt

一、javascritp几种用法:

1、文档内嵌脚本

<head>

<script type="text/javascript">
document.write("hello world!")
</script>
</head>
<body>
<p>上面的内容哪来的!</p>

</body>

2、载入外部脚本

(1)hi.JS文件:

document.write("I love FishC.com!");

(2)HTML链接JS:

<head>
<script type="text/javascript" src="js/hi.js"></script>
</head>

 3、延迟脚本

<script type="text/javascript" src="js/patch.js" defer></script>
\*defer 只用于外部文件,内部文件不起作用*\

4、异步脚本

猜你喜欢

转载自www.cnblogs.com/alision/p/11141704.html