正常的在 js 文件中写一个函数
- function test1(){alert("这样是调用不到的");
- }
只有这样声明才能调用到
- test=function(){
- alert("可以调用");
- }
然后在 html 页面中
<script>
test(); 这样就调用成功了
</script>
html 页面调用 js 文件里的函数, 写法必须为 test= function (){} 形式, 其他方式写无用.
来源: http://www.bubuko.com/infodetail-2770639.html