在使用getElementById时遇到一些麻烦 [英] having some trouble with getElementById

查看:71
本文介绍了在使用getElementById时遇到一些麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法让getElementById工作时

我在外部js文件中创建一个元素。



例子...

I can''t seem to get getElementById to work when
I create an element in an external js file.


example...

展开 | 选择 | Wrap | 行号

推荐答案

从文章部分移动。


请记住在发布代码时使用代码标签。


至于你的问题,你将id设置为stuff。然后你试图访问id为temp的元素。
Moved from Articles section.

Please remember to use code tags when posting code.

As to your problem, you set the id to "stuff" and then you''re trying to access the element with the id "temp".


谢谢。


我尝试了你的建议但仍然不起作用。
thanks.

I tried your suggestion and still does not work.


我将id设置为stuff。然后你试图访问id为stuff的元素......不起作用。
I set the id to "stuff" and then you''re trying to access the element with the id "stuff"...does not work.


这篇关于在使用getElementById时遇到一些麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆