参考错误:JS没有加载脚本或资金功能 [英] Reference error: JS not loading script or funding function
问题描述
您好
在未加载脚本源的HTML标记中出现问题。参考错误的问题:在控制台中显示按钮回叫事件没有响应的未识别方法。
ReferenceError: inputAccept未定义
function anputAccept(){ // 这里的陈述};
< - this找不到方法/初始化?
我现在已经被困3小时了。任何人都可以解释参考错误/失败加载如何以及为什么会发生,以及如何修复它以便脚本可以加载?这不仅对我有帮助,而且对将来遇到类似问题的其他人也有帮助。
我怀疑它与HTML中的DOM / OBJECT配置有关,因为脚本已经运行了几个不同的分析器,产生了0个错误(包括代码笔)。因此,到目前为止,.js文件看起来很干净,因此事件/方法回调配置部分存在问题。
< script>
document .getElementById( pushme).addEventListener( 点击,inputAccept);
document .getElementById( reset).addEventListener( 点击,resetMe);
< / script>
我尝试过:
-将脚本从标签移动到底部标签
- 在.js中使用addEventListener并使用迁移到HTML。
-通过控制台和JSLint诊断.js
-Re-formatted JS文件以运行更少的脚本并使用更少但更有效的可重用变量。
- 通过几个不同的分析器重新测试脚本。
使用document.inputAccept = function()
和
documentLinner中的document.inputAccept/ BLOCKQUOTE>
Hello
Have an issue in a HTML tag where the script source is not loading. Also the problem with a Reference Error: unidentified method showing in console where a button call-back event is not responding.
ReferenceError: inputAccept is not defined
function anputAccept() {//statements here };<--this method is not found/initalized?
I've been stuck on this for 3 hours now. Could anyone explain how and why a Reference Error/Failed Load can occur, and how to fix it so the script can load? This would not only be helpful to me, but also to others that come across a similar problem in future.
I'm suspecting it has something to do with the DOM/OBJECT configurations inside the HTML, as the script has been ran through several different analyzers with 0 produced errors (including code-pen). So as the .js file looks clean so far, there is issue with the event/method call-back configuration part.
<script> document.getElementById("pushme").addEventListener("click",inputAccept); document.getElementById("reset").addEventListener("click",resetMe); </script>
What I have tried:
-Moving the script from tags to bottom tags
-Changing the use of addEventListener in .js and migration to HTML using .
-Diagnosing the .js through console and JSLint
-Re-formatted the JS file to run fewer scripts and use fewer but more efficient reusable variables.
-Re-tested script through several different analyzers.解决方案Got it to work withdocument.inputAccept=function()
and
document.inputAcceptin the EventListener
这篇关于参考错误:JS没有加载脚本或资金功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!