document.getElementById无法正常运作 [英] document.getElementById not working

查看:82
本文介绍了document.getElementById无法正常运作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面上有2个复选框。表格单元包装在各自的行中。执行document.getElementById('chk1_FEAS〜1005')会返回元素,但document.getElementById('chk5_STG2〜1005')为空。出于什么原因会发生这种情况? (我正在IE 8中进行测试)。

I have 2 chekboxes on a page. There are wrapped in a table cell each within their own row. Doing a document.getElementById('chk1_FEAS~1005') returns the element but document.getElementById('chk5_STG2~1005') is null. For what reasons could this be happening? (I'm testing in IE 8).

<input id="chk1_FEAS~1005" value="JobStages###StageCode~JobCode###FEAS~1005" onclick="addRemoveRow(this.value,this.checked)" style="border-width:0px;padding:1px;margin:0px;height:14px;"  type="checkbox" />

<input id="chk5_STG2~1005" value="JobStages###StageCode~JobCode###STG2~1005" onclick="addRemoveRow(this.value,this.checked)" style="border-width:0px;padding:1px;margin:0px;height:14px;"  type="checkbox" />


推荐答案

您的ID包含无效字符:

Your Id has invalid characters:


ID和NAME令牌必须以
字母([A-Za-z])开头,并且可以在
后跟任意数字字母,数字
([0-9]),连字符(-),下划线
( _),冒号(:)和句点
(。 。

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

更多信息此处

这篇关于document.getElementById无法正常运作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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