错误提示是错误: oDataGrid has no properties
源文件:http://localhost/demo/
行:93
源文件:http://localhost/demo/
行:93
解决方案 »
- 新手关于jquery的疑问。
- Access中为什么只能插入数字和字母,而插不进文字去呢?数据表中我明明设置的是文本型的啊?
- 预先隐藏(display=none)时动态增加的select ,显示(display=block)后无法展开?
- 急问,javascript中的数组元素
- JS中改变背景图片大小
- |zyciis| 如何取TextBox的文本改变的方法呢??这里说的是通过用Javascript赋值的方法改变的,谢谢
- 帮帮忙!!
- NND搞了半天就是出现有错Checkbox
- [求助]一个具体的javascript变量空值判断问题
- 当我打开一个IE的 window时,点关闭时有没有相应的事件
- 引入js的路径问题
- web打印多行的表格
for(var i=1;i < oDataGrid.rows.length;i++)
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<script type="text/javascript">
window.onload = function () {
var ta = document.getElementsByTagName("table")[0];
ta.rows[0].style.backgroundColor = "#000000";
ta.rows[1].style.backgroundColor = "#CCCCCC";
};
</script>
你写错了还是你自己定义的??
用:
document.getElementById("DataGrid1"),
应该没错!
function getElementByIds(swfId) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[swfId]
}
else {
return document[swfId]
}
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<table id="DataGrid1" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<script type="text/javascript">
window.onload = function () {
var ta = document.getElementById("DataGrid1");
ta.rows[0].style.backgroundColor = "#000000";
ta.rows[1].style.backgroundColor = "#CCCCCC";
};
</script></body>
</html>这个是正确的!!!
function getElementByIds(swfId) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[swfId]
}
else {
return document[swfId]
}
}
-------------------------------
不要这样用,直接用document.getElementById(),这个在IE和FF下面都可以用!
=======
这个我还在测试 但是我看不出来我写的跟你的有什么不同
<script>
document.getElementById('t').rows[0].style.backgroundColor="red";
</script>这样是可以兼容IE,FF的,你参考一下自行解决吧!