错误提示是错误: oDataGrid has no properties
源文件:http://localhost/demo/
行:93
源文件:http://localhost/demo/
行:93
解决方案 »
- 请教高手jQuery怎么取得本地语言 比如:zh-CN
- myeclipse8.5不能js提示了,下面是出问题的地方,求大神帮帮忙
- html5功能 引用了excanvas.js之后IE还是无法显示
- 各位高手,帮帮我啊
- javascript怎么弹出“类似于模式对话框”的登录窗口,要求没有关闭按钮
- 请教:js树形菜单的键盘控制
- 客户端JavaScript脚本能否访问数据库?或把数据传回服务器端
- 如何在一个表单中,点不同的提交按钮,提交到不同的处理页面?
- 我要感谢给我回答问题的人wangxj0600(wamgxj0600),但我不知如何给分:)
- 如何把XML+XSL的输出结果显示到一个指定的HTML元素里?
- 引入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的,你参考一下自行解决吧!