调用 外部引入的js里面的方法在onload()中可触发,其他事件中无法触发
index.js文件中引入了外部js文件,想通过input输入事件来调用js中的方法,但是报了如下错误:
(index.js中引入该外部文件写法正确,因为下方onload方法确实触发了该js文件中的方法)

index.js文件中的写法为:

外部引入js文件为

在onload()中调用该方法可以成功:

但是不通过onload(),使用其他的触发方式,比如bindtap触发就会报出:
