js代码提示脚本有误,高手帮忙修改下!解决方法
发布时间:2010-05-20 14:01:29 文章来源:www.iduyao.cn 采编人员:星星草
js代码提示脚本有误,高手帮忙修改下!!!!
运行js脚本提示style为空或不是对象,js脚本如下,请帮忙修改下:
<script language="javascript">
window.onload=function showtable(){
var tablename=document.getElementById("mytable");
var li=tablename.getElementsByTagName("tr");
for (var i=0;i<=li.length;i++){
if(i%2==0){
li[i].style.backgroundColor="#F3F8F7";
li[i].onmouseout=function(){
this.style.backgroundColor="#F3F8F7"
}
}else{
li[i].style.backgroundColor="#fff";
li[i].onmouseout=function(){
this.style.backgroundColor="#fff"
}
}
li[i].onmouseover=function(){
this.style.backgroundColor="#beeeff";
}
}
}
</script>
<table id="mytable" width="99%" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td width="18%上传个人照片</td>
<td width="82%"> </td>
</tr>
<tr>
<td >个人简介</td>
<td> </td>
</tr>
<tr>
<td >联系电话</td>
<td> </td>
</tr>
<tr>
<td > </td>
<td> </td>
</tr>
</table>
------解决方案--------------------
for (var i=0;i<=li.length-1;i++){
}
-1下 。
下标越界了 。
------解决方案--------------------
<td width="18%">上传个人照片</td>
这个标签没闭合 。
------解决方案--------------------
for (var i=0;i<=li.length;i++){
改为
for (var i=0;i<li.length;i++){
<td width="18%">上传个人照片</td>
这个标签没闭合
------解决方案--------------------
var tablename=document.getElementById("mytable");
var li=tablename.rows;
for (var i=0;i<li.length;i++)
{
if(i%2==0){
li[i].style.backgroundColor="#F3F8F7";
li[i].onmouseout=function(){
this.style.backgroundColor="#F3F8F7"
}
}else{
li[i].style.backgroundColor="#fff";
li[i].onmouseout=function(){
this.style.backgroundColor="#fff"
}
}
li[i].onmouseover=function(){
this.style.backgroundColor="#beeeff";
};
}
------解决方案--------------------
for (var i=0;i<=li.length;i++){
红色部分去掉。。。。
------解决方案--------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
运行js脚本提示style为空或不是对象,js脚本如下,请帮忙修改下:
<script language="javascript">
window.onload=function showtable(){
var tablename=document.getElementById("mytable");
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。
其他相似内容:
-
风生水起才知天高云淡,沧海横流方显英雄本色 百万商业圈云平台免费发布,几十万台电脑变成一台不是梦
百万商业圈分布式云平台功能...
-
登录问题
登录服务器为A 、代理服务器为B 、服务器资源为C.
http发送 验证成功 https请求资源
1.A<---...
-
集群的问题
看了网上很多文章,不是很理解怎么集群的,一下又memcache集群的,一下又mysql集群,还有什么nginx
。
具我了解nginx起的作用...
-
关于计费系统里面的预付费和后付费概念
由于本人刚接触计费系统,对里面的一些概念还有点模糊,特别是对预付费和后付费的理解,我的问...
-
很幽默的讲解六种Socket IO模型(转)
本文简单介绍了当前Windows支持的各种Socket I/O模型,如果你发现其中存在什么错误请务必赐教...
-
数据库读写分离时候可能碰到的问题
数据库读写分离后,如果碰到一种插入操作,是需要对数据做检索后再进行的
例如用户注册,需要检测用...
-
奇怪啊,为何我的一个SWF浏览器缓存文件会被自动清除
我已经设置了这个文件的max-age是100天,也就是说,这个文件会在浏览器缓存里放10...
-
Myfaces日历控件无法弹出
代码如下:
<x:inputCalendar monthYearRowClass="yearMonthHeader"
weekRowClass="w...
-
到底什么才是Web Services
我曾经做过一个android的软件,当时的思想是这样的,我用SSH框架做了一个Web服务端,这个服务端暴露了很多的...
-
Web服务和文件服务分离后的问题
(A是Web服务器,B是文件服务器)
1 A网络映射B,访问A上传文件到B通过映射的路径实现。显示B中的...