因为你的代码不符合标准
marqueeBox.appendChild(nextLine);
marqueeBox.childNodes.length
像这些,在IE中可以直接用ID,但是FF中不行
用document.getElementById("marqueeBox")代替marqueeBox试试
marqueeBox.appendChild(nextLine);
marqueeBox.childNodes.length
像这些,在IE中可以直接用ID,但是FF中不行
用document.getElementById("marqueeBox")代替marqueeBox试试
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<style type="text/css">
td {font-size: 12px;}
</style>
<script language="javascript">
<!--
var marqueeContent=new Array(); //滚动主题
marqueeContent[0]='<a href="http://lanren.makewing.com/" target="_blank">+ 学会偷懒,并懒出境界是提高工作效率最有效的方法!</a>';
marqueeContent[1]='<a href="http://lanren.makewing.com/" target="_blank">+ 显而易见,最高的效率就是对现有材料的最佳利用。</a>';
marqueeContent[2]='<a href="http://lanren.makewing.com/" target="_blank">+ 自己能解决的事,别花钱,花钱能解决的事,别求人。</a>';
marqueeContent[3]='<a href="http://lanren.makewing.com/" target="_blank">+ 旅行是需要一种心情,更重要的是,需要一种冲动。</a>';
marqueeContent[4]='<a href="http://lanren.makewing.com/" target="_blank">+ 随时用零碎的时间(如等人、排队等)做零碎的事情。</a>';var marqueeInterval=new Array(); //定义一些常用而且要经常用到的变量
var marqueeId=0;
var marqueeDelay=4000;
var marqueeHeight=15;
var marqueeBox=null;
function initMarquee() {
var str=marqueeContent[0];
document.write('<div id=marqueeBox style="overflow:hidden;height:'+marqueeHeight+'px" onmouseover="clearInterval(marqueeInterval[0])" onmouseout="marqueeInterval[0]=setInterval(\'startMarquee()\',marqueeDelay)"><div>'+str+'</div></div>');
marqueeId++;
marqueeInterval[0]=setInterval("startMarquee()",marqueeDelay);
}
function startMarquee() {
marqueeBox=document.getElementById("marqueeBox");
var str=marqueeContent[marqueeId];
marqueeId++;
if(marqueeId>=marqueeContent.length) marqueeId=0;
if(marqueeBox.childNodes.length==1) {
var nextLine=document.createElement('DIV');
nextLine.innerHTML=str;
marqueeBox.appendChild(nextLine);
}
else {
marqueeBox.childNodes[0].innerHTML=str;
marqueeBox.appendChild(marqueeBox.childNodes[0]);
marqueeBox.scrollTop=0;
}
clearInterval(marqueeInterval[1]);
marqueeInterval[1]=setInterval("scrollMarquee()",10);
}
function scrollMarquee() {
marqueeBox.scrollTop++;
if(marqueeBox.scrollTop%marqueeHeight==marqueeHeight){
clearInterval(marqueeInterval[1]);
}
}
-->
</script>
</head> <body>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="15" valign="top"><img src="images/news.gif" alt="" width="11" height="11" /></td>
<td width="64">懒人消息:</td>
<td width="321"><script language="javascript">
<!--
initMarquee();
//-->
</script></td>
</tr>
</table>
</body>
</html>