這是一個模擬股票滾屏的看板程序,程序將10個股票的價格和張跌幅信息以每次5組的方式顯示,循環交替,不同以往滾屏尾部留有空白的情況。由於代碼簡單,這裡就不對其多加注釋了。
<Html>
<head>
<!-- [email protected] -->
<script LANGUAGE="VBScript">
<!--
dim j,arry1(10),arry2(10),arry3(10),arry4(10)
'分別定義滾動子段的數組
arry1(0)="數碼科技"
arry1(1)="太子網絡"
arry1(2)="小邦會社"
arry1(3)="正大集團"
arry1(4)="聚友網絡"
arry1(5)="全向科技"
arry1(6)="清華紫光"
arry1(7)="同創科技"
arry1(8)="中關村"
arry1(9)="TCL電子"
arry2(0)="12.56"
arry2(1)="56.50"
arry2(2)="5.54"
arry2(3)="23.11"
arry2(4)="16.70"
arry2(5)="14.00"
arry2(6)="9.20"
arry2(7)="12.30"
arry2(8)="87.56"
arry2(9)="12.30"
arry3(0)="12.10"
arry3(1)="55.70"
arry3(2)="5.36"
arry3(3)="22.80"
arry3(4)="16.50"
arry3(5)="13.60"
arry3(6)="9.20"
arry3(7)="12.89"
arry3(8)="88.00"
arry3(9)="12.56"
arry4(0)="6.2%"
arry4(1)="-5%"
arry4(2)="1.2%"
arry4(3)="8%"
arry4(4)="-5.6%"
arry4(5)="3%"
arry4(6)="-3%"
arry4(7)="4%"
arry4(8)="-2.2%"
arry4(9)="-6.3%"
'滾動程序
Sub toplay()
j=j+1
for i=0 to 4
a(i).innerHtml=show1(j-1+i)
b(i).innerHtml=show2(j-1+i)
c(i).innerHtml=show3(j-1+i)
d(i).innerHtml=show4(j-1+i)
next
if j>9 then j=0
settimeout "toplay",2000
end sub
function show1(num)
if num=>10 then
show1=arry1(num-10)
else
show1=arry1(num)
end if
end function
function show2(num)
if num=>10 then
show2=arry2(num-10)
else
show2=arry2(num)
end if
end function
function show3(num)
if num=>10 then
show3=arry3(num-10)
else
show3=arry3(num)
end if
end function
function show4(num)
if num=>10 then
show4=arry4(num-10)
else
show4=arry4(num)
end if
end function
-->
</script>
<style>
<!--
td { font-size:9pt }
-->
</style>
</head>
<body onload="toplay()">
<table border="0" cellpadding="5" cellspacing="1">
<tr>
<td bgcolor="#FFCC66">證券名稱</td>
<td bgcolor="#FFCC66">成交</td>
<td bgcolor="#FFCC66">開盤</td>
<td bgcolor="#FFCC66">漲跌</td>
</tr>
<%
for i=0 to 4
dim bg
bg="F0EDE6"
if i mod 2=0 then bg="D2E0F0"
%>
<tr>
<td id="a" bgcolor=<%=bg%> align="right"></td>
<td id="b" bgcolor=<%=bg%> align="right"></td>
<td id="c" bgcolor=<%=bg%> align="right"></td>
<td id="d" bgcolor=<%=bg%> align="right"></td>
</tr>
<%next%>
</table>
</body>
</Html>
注:你可以更改其中的每組顯示股票的行數,這裡設置的是5個。