惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Security Blog
Microsoft Security Blog
J
Java Code Geeks
GbyAI
GbyAI
aimingoo的专栏
aimingoo的专栏
L
LangChain Blog
I
InfoQ
D
Docker
F
Fortinet All Blogs
Y
Y Combinator Blog
Martin Fowler
Martin Fowler
月光博客
月光博客
B
Blog
Engineering at Meta
Engineering at Meta
T
Tailwind CSS Blog
罗磊的独立博客
博客园_首页
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog RSS Feed
IT之家
IT之家
V
V2EX

博客园 - 东哥

MongoVUE 错误:can't map file memory - mongo requires 64 bit build for larger datasets HTTP Header 属性列表 安装卸载Windows服务,修改windows服务执行路径! SQL 语句嵌套,自己记录下。 基于RBAC的权限设计模型 三级连动JS数据库查询代码整理 动态添加WEB控件,点控件获取动态添加的控件 数据库基本----SQL语句大全 使用Ajax时的十个常犯的错误 数据采集程序(网页小偷)点滴心得 WEB Service 下实现大数据量的传输 [转]将上传图片打上防伪图片水印并写入数据库 我奋斗了18年不是为了和你一起喝咖啡(转载) [转]社区好友列表利用率越高,社区越失败 很实用的一个图片上传得例子 [转帖]教程:使用WebService进行异步通信 如何用Javascript记录登陆次数 很酷实用的右键弹出菜单(Js+DVML) JavaScript如果文字过长,则将过长的部分变成省略号显示
javascript中getElementsByName的问题
东哥 · 2008-06-18 · via 博客园 - 东哥

当在IE中使用document.getElementsByName时,需要同时设置id和name,要不然,取得的elements都为空。

例:

 <div id="sent1" name="sent1" onclick="javascript:show(this)">
  <span class="pytop">nihaoUP</span>
  <span class="text">你好</span>
  <span class="pybottom">nihaoDOWN</span>
 </div>

 <div id="sent1" name="sent1" onclick="javascript:show(this)">
  <span class="pytop">nihaoUP</span>
  <span class="text">你好,</span>
  <span class="pybottom">nihaoDOWN</span>
 </div>
在使用document.getElementByXXX时,经常会遇到这个问题,因此首先应该检查是否id和name都设置了。

posted on 2008-06-18 17:59  东哥  阅读(805)  评论(0)    收藏  举报