首页 > 解决方案 > JavaScript,“绑定”是什么意思,而不是“绑定”?document.binde.tagname...?

问题描述

我的 JS 代码中有一些带有 的行binde,它是什么?为什么它有效,它是什么意思?

例如,type="checkbox"

if (document.binde.nameofthecheckbox.checked)
{
    //...its true whens checked and do the code
}

或者

somevar = document.binde.somehtmltagname.value; 

somevar获取“somehtmltagname”的值

没有人能回答我,我只听说“以前从未见过这样的事情”。我很高兴知道它是什么,而不仅仅是因为它有效而使用它。

标签: javascript

解决方案


它并不为人所知,但可能会这样document定义 HTML 元素,如果页面上有一个,它将指向那个。iddocument[HTMLElement.ID]<input id="binde">

如果没有,请尝试记录它:

console.log(document.binde)

推荐阅读