function
sayHello(){
console.log('Hello
World!')
}
如果你想在js文件加载后,立即执行sayHello()函数,那么可以在js中加入
sayHello()的调用即可。
如果你要调用已经写好的JS的话要这么写比如我现在写一个abc()的方法存在与JS.JS中
然后调用
<script src="JS.JS"></script>
<script>abc()</script>
function
sayHello(){
console.log('Hello
World!')
}
如果你想在js文件加载后,立即执行sayHello()函数,那么可以在js中加入
sayHello()的调用即可。
如果你要调用已经写好的JS的话要这么写比如我现在写一个abc()的方法存在与JS.JS中
然后调用
<script src="JS.JS"></script>
<script>abc()</script>