内部JS
在head中插入下面代码。
<script type="text/javascript">
function test() {
alert('This is a test');
}
</script>
然后可以在body中进行调用。
<input type="button" value="Test" οnclick="test()">
外部JS
可以在head中插入下面代码。
<script src="js/test.js" type="text/javascript" charset="utf-8">
需要在同一目录生成一个js文件夹,再写一个.js文件。