直接用IE的 marquee 不行吗??
<marquee id=mm direction="right" scrolldelay="70" scrollamount="6">meizz</marquee><br>
<input type=button value=加速 onclick="add()">
<input type=button value=减速 onclick="sub()">
<input type=button value=right onclick="e.direction='right'">
<input type=button value=left onclick="e.direction='left'">
<input type=button value=up onclick="e.direction='up'">
<input type=button value=down onclick="e.direction='down'">
<script language="JavaScript"><!--
var e = document.getElementById("mm");
function add()
{
var n = 10;
if(e.scrollDelay-n > 0)
e.scrollDelay -= n;
e.scrollAmount += 1;
}
function sub()
{
if(e.scrollAmount > 0)
e.scrollAmount -= 1;
e.scrollDelay += 10;
}
//--></script>
<marquee id=mm direction="right" scrolldelay="70" scrollamount="6">meizz</marquee><br>
<input type=button value=加速 onclick="add()">
<input type=button value=减速 onclick="sub()">
<input type=button value=right onclick="e.direction='right'">
<input type=button value=left onclick="e.direction='left'">
<input type=button value=up onclick="e.direction='up'">
<input type=button value=down onclick="e.direction='down'">
<script language="JavaScript"><!--
var e = document.getElementById("mm");
function add()
{
var n = 10;
if(e.scrollDelay-n > 0)
e.scrollDelay -= n;
e.scrollAmount += 1;
}
function sub()
{
if(e.scrollAmount > 0)
e.scrollAmount -= 1;
e.scrollDelay += 10;
}
//--></script>
我要的是点击按钮时滚动显示下四条记录。不按按妞的时候,四条记录是不会换的。
上滚已经实现,下滚老是搞不出。
请指点下,谢谢
<tr>
<td width="235" valign="top" rowspan=2>
<div id="scrollBoard" name="scrollBoard" width=235></div>
<script language="javascript">
heightPerLine = 17;
srollLinesPerClick = 4; var strContents = "";
for(var i=0;i<5;i++){
strContents += '<table width="100%" bgcolor=black color=white border="0" height="'+(heightPerLine * srollLinesPerClick)+'" cellpadding="0" cellspacing="0">';
for(var j=0;j<srollLinesPerClick;j++){
strContents += '<tr><td height="'+heightPerLine+'" style="font-size:12px;color:white"><strong>上下滚动'+(i*srollLinesPerClick+j)+'</strong></td></tr>';
}
strContents += '</table>';
} scrollBoard.innerHTML = '';
scrollBoard.insertAdjacentHTML('beforeEnd',strContents); scrollBoardHeight = heightPerLine * srollLinesPerClick; //内容区高度 stopscroll=true; //这个变量控制是否停止滚动
bIsUp = true;
with(scrollBoard){
style.height=scrollBoardHeight;
style.overflowY="hidden";
} var nLastPosH = 0; function UpStart(){
stopscroll = false;
bIsUp = true;
a_scrollUp();
}
function DownStart(){
stopscroll = false;
bIsUp = false;
a_scrollUp();
}
function ToStop(){
stopscroll = true;
//preTop = -1;
}
function a_scrollUp(){
if(stopscroll==true)
return;
preTop = scrollBoard.scrollTop;
if(bIsUp){
scrollBoard.scrollTop+=1;
if(nLastPosH + scrollBoardHeight == scrollBoard.scrollTop){
nLastPosH = scrollBoard.scrollTop;
ToStop();
//alert(nLastPosH + ":" + scrollBoard.scrollTop);
return;
}
}
else{
scrollBoard.scrollTop-=1;
if(nLastPosH - scrollBoardHeight == scrollBoard.scrollTop){
nLastPosH = scrollBoard.scrollTop;
ToStop();
return;
}
}
setTimeout("a_scrollUp()",20);
}
</script>
</td>
<td valign="top"><input type=button value="上" width="11" height="11" alt="" border="0" onClick="javascript:DownStart()" style="cursor:hand;"></td>
</tr>
<tr>
<td valign="bottom"><input type=button value="下" width="11" height="11" alt="" border="0" onClick="javascript:UpStart()" style="cursor:hand;"></td>
</tr>
</table>