参考错误:JS没有加载脚本或资金功能

编程入门 行业动态 更新时间:2024-10-21 09:43:03
本文介绍了参考错误:JS没有加载脚本或资金功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

您好 在未加载脚本源的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 with

document.inputAccept=function()

and

document.inputAccept

in the EventListener

更多推荐

参考错误:JS没有加载脚本或资金功能

本文发布于:2023-11-28 16:35:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643153.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   加载   错误   资金   功能

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!