getElementsByName

来源:互联网 发布:淘宝卖东西的钱在哪里 编辑:程序博客网 时间:2024/04/29 12:01

1.可以在 JSP 文件的 <% 和 %> 标记间直接嵌入任何有效的 Java 语言代码。这样嵌入的代码称为 scriptlet。

1. 对于表单控件<input><select><textarea>等,在不指定id的时候,name也会被视作id,比如<input type="text" name="abc" value="123">也可以用document.getElementById("abc")来获取
2. 其实一句话:ID和html页面内部元素相关,不和页面元素的内容相关。name则更多地和页面元素的内容相关。
3. 
var tdList = document.getElementsByName("TD_"+ i);
for(var j=0; j<tdList.length; j++)
{
tdList[j].style.backgroundColor="E4E4E4";
}
在HTML4.01不推荐使用tr元素的"bgcolor"属性
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" http://www.w3.org/TR/html4/loose.dtd


bgcolor是HTML,bgColor是JScript,backgroundColor是javascript

<td bgcolor="#FF6699" onMouseOver="this.bgColor='#FF99CC'" onMouseOut="this.bgColor='#ff6699'">&nbsp;</td>

<td bgcolor="#FF6699" onMouseOver="this.style.backgroundColor='#FF99CC'" onMouseOut="this.style.backgroundColor='#ff6699'">&nbsp;</td>
 

原创粉丝点击