[求助]垂直滚动

阅读:4310回复:2
2006-06-15 19:50
写私信
楼主#
为什么这代码在FIREFOX中无效?是不是CSS的问题?
但是去除了"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">"后又可以,怎么回事?



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<script type="text/javascript">
//<![CDATA[
var marqueeContent=new Array();   //
marqueeContent[0]='<font color="#0000CC">14:25 </font><a href=# target=_blank class="f12red">aaa</a><br>';
marqueeContent[1]='<font color="#0000CC">14:25 </font><a href=# target=_blank class="f12red">Ҿaaa</a><br>';
marqueeContent[2]='<font color="#0000CC">14:25 </font><a href=#  target=_blank class="f12red">aaa</a><br>';
marqueeContent[3]='<font color="#0000CC">14:25 </font><a href=# target=_blank class="f12red">ҿ϶aaa</a><br>';
var marqueeInterval=new Array();
var marqueeId=0;
var marqueeDelay=2000;
var marqueeHeight=20;
function initMarquee() {
var str=marqueeContent[0];
document.write('<div id="marqueeBox" style="overflow:hidden;height:'+marqueeHeight+'px;height:'+marqueeHeight+'px transparent !important;" onmouseover="clearInterval(marqueeInterval[0])" onmouseout="marqueeInterval[0]=setInterval(\'startMarquee()\',marqueeDelay)"><div>'+str+'</div></div>');
marqueeId++;
marqueeInterval[0]=setInterval("startMarquee()",marqueeDelay);
}
function startMarquee() {
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()",20);
}
function scrollMarquee() {
marqueeBox.scrollTop++;
if(marqueeBox.scrollTop%marqueeHeight==(marqueeHeight-1)){
clearInterval(marqueeInterval[1]);
}
}
initMarquee();
//]]>
</script>
</body>
</html>
2006-06-15 19:50
写私信
1楼#
scrolltop属性似乎有问题,另外我还有滚动问题
我也有个滚动的问题需要请教,在IE中,可以使用object.doscroll()函数来模拟滚动条的拖拉,来实现程序控制的内容滚动.可是在firebox中并没有该函数.怎么实现相同功能?
另外,我想请教的是,类似doscroll之类的函数(还有个两边都可以用的scrollintoview函数)既没有在dom标准中定义也没有在EMCAScript中定义,那么是属于浏览器核心API的范畴么?在哪里可以找到firefox支持的属性,函数手册??
谢谢高手们的指点了