1.使用标签<script>在head、body中直接使用
<script>
alert('hello')
</script>
2.从外部导入.js文件
<script src="test.js"></script>
3.使用链接的方式
<a href="javascript:alert('hello');">test</a>
1.使用标签<script>在head、body中直接使用
<script>
alert('hello')
</script>
2.从外部导入.js文件
<script src="test.js"></script>
3.使用链接的方式
<a href="javascript:alert('hello');">test</a>