日期:2014-03-13  浏览次数:20770 次


第一步:请将下列原代码放入html文件的<head>和</head>之间:

<script>
<!--
lstart=160
loop=true
speed=350
pr_step=5
functionmakeObj(obj,nest){
nest=(!nest)?'':'document.'+nest+'.'
this.css=(document.layers)?
eval(nest+'document.'+obj):eval(obj+'.style')
this.scrollHeight=document.layers?this.css.document.height:eval(obj+'.
offsetHeight')
this.up=goUp
this.obj=obj+"Object"
eval(this.obj+"=this")
returnthis
}
functiongoUp(speed){
if(parseInt(this.css.top)>-this.scrollHeight){
this.css.top=parseInt(this.css.top)-pr_step
setTimeout(this.obj+".up("+speed+")",speed)
}elseif(loop){
this.css.top=lstart
eval(this.obj+".up("+speed+")")
}
}
functionslideInit(){
oSlide=makeObj('divNews','divCont')
oSlide.css.top=lstart
oSlide.up(speed)
}
onload=slideInit
//-->
</script>

注:其中lstart设置起始位置,loop设置是否循环,speed是滚动速度,pr_step设置间距。


第二步:请将下列代码放入html文件的任何地方,建议放在最后,就是</html>之后:

<divid="divCont" style="position:absolute;width:300;height:100;top:120;left:280; clip:rect(0,250,150,0)">
<divid="divNews"style="position:absolute;top:0;left:0">
<p>
</font>
<fontcolor="#408080">这是一个滚动看板</font>
<fontface="Arial"color="#408080"><br>
</font>
<fontcolor="#408080">但并不是大家经常看到的</font>
<fontface="Arial"color="#408080"><br>
</font>
<fontcolor="#408080">用</font>
<fontface="Arial"color="#408080">
<font face="Arial">java</font>
</font>
<fontcolor="#408080">实现的那种</font>
<fontface="Arial"color="#408080"><br>
</font>
<fontcolor="#408080">它采用</font>
<fontface="Arial"color="#408080">
<font face="Arial">javacript</font>
</font><fontcolor="#408080">语言和</font>
<fontface="Arial"color="#408080">
<fontface="Arial">DHTML</font>
</font>
<fontcolor="#408080">的层</font>
<fontface="Arial"color="#408080"><br>
</font>
<fontcolor="#408080">所以你看到的原代码</font>
<fontface="Arial"color="#408080"><br>
</font>
<fontcolor="#408080">不需要固定在</font>
<fontface="Arial" color="#408080">form</font>
<fontcolor="#408080">框里或者表格里</font>
<fontface="Arial"color="#408080"><br>
</font>
<fontcolor="#408080">它是用的</font>
<fontface="Arial"color="#408080">
<font face="Arial">
<div></div>
</font><br>
</font>
<fontcolor="#408080">你可以把这段代码放在</font>
<fontface="Arial"color="#408080"><fontface="Arial">HTML<br>
</font>
</font>
<fontcolor="#408080">代码里的任何地方</font>
<fontface="Arial"color="#408080"><br>
</font>
<fontcolor="#408080">都不会影响它出现的位置<