来源gaodaima#com搞(代@码网在html中引入外部js文件,并调用js文件中的带参函数
1 项目结构
2 编写a.js、test.html
//a.jsfunction abc(str){ alert(str);}//test.html<html><head><script type="text/javascript" src="a.js"></script><script type="text/javascript"> window.onload = function(){var fun = abc; //引用abc函数fun(123); }; </script></head><body></body></html>
3 测试结果