gpt4 book ai didi

javascript - Javascript 中的 GetElementById

转载 作者:行者123 更新时间:2023-11-30 08:46:02 27 4
gpt4 key购买 nike

我想获取某种形式的ElementById但是它显示错误

Uncaught TypeError: Object # has no method 'getElementById'

这是我的代码

varForm = document.forms['newform'].getElementById("yellow");

最佳答案

ID 是唯一的 -所以没有区别(你得到你想要的),直接调用它(/正确):

var Form = document.getElementById("yellow");

关于javascript - Javascript 中的 GetElementById,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21966876/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com