运用asp结合vbscript模拟股票滚屏

2001-03-25 10:35:42  作者
这是一个模拟股票滚屏的看板程序,程序将10个股票的价格和张跌幅信息以每次5组的方式显示,循环交替,不同以往滚屏尾部留有空白的情况。由于代码简单,这里就不对其多加注释了。

%26lt;html%26gt;
%26lt;head%26gt;
%26lt;!-- sunboy008@sina.com.cn --%26gt;
%26lt;script LANGUAGE=%26quot;VBScript%26quot;%26gt;
%26lt;!--
dim j,arry1(10),arry2(10),arry3(10),arry4(10)

'分别定义滚动子段的数组

arry1(0)=%26quot;数码科技%26quot;
arry1(1)=%26quot;太子网络%26quot;
arry1(2)=%26quot;小邦会社%26quot;
arry1(3)=%26quot;正大集团%26quot;
arry1(4)=%26quot;聚友网络%26quot;
arry1(5)=%26quot;全向科技%26quot;
arry1(6)=%26quot;清华紫光%26quot;
arry1(7)=%26quot;同创科技%26quot;
arry1(8)=%26quot;中关村%26quot;
arry1(9)=%26quot;TCL电子%26quot;

arry2(0)=%26quot;12.56%26quot;
arry2(1)=%26quot;56.50%26quot;
arry2(2)=%26quot;5.54%26quot;
arry2(3)=%26quot;23.11%26quot;
arry2(4)=%26quot;16.70%26quot;
arry2(5)=%26quot;14.00%26quot;
arry2(6)=%26quot;9.20%26quot;
arry2(7)=%26quot;12.30%26quot;
arry2(8)=%26quot;87.56%26quot;
arry2(9)=%26quot;12.30%26quot;


arry3(0)=%26quot;12.10%26quot;
arry3(1)=%26quot;55.70%26quot;
arry3(2)=%26quot;5.36%26quot;
arry3(3)=%26quot;22.80%26quot;
arry3(4)=%26quot;16.50%26quot;
arry3(5)=%26quot;13.60%26quot;
arry3(6)=%26quot;9.20%26quot;
arry3(7)=%26quot;12.89%26quot;
arry3(8)=%26quot;88.00%26quot;
arry3(9)=%26quot;12.56%26quot;


arry4(0)=%26quot;6.2%%26quot;
arry4(1)=%26quot;-5%%26quot;
arry4(2)=%26quot;1.2%%26quot;
arry4(3)=%26quot;8%%26quot;
arry4(4)=%26quot;-5.6%%26quot;
arry4(5)=%26quot;3%%26quot;
arry4(6)=%26quot;-3%%26quot;
arry4(7)=%26quot;4%%26quot;
arry4(8)=%26quot;-2.2%%26quot;
arry4(9)=%26quot;-6.3%%26quot;

'滚动程序
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%26gt;9 then j=0
settimeout %26quot;toplay%26quot;,2000
end sub

function show1(num)
if num=%26gt;10 then
show1=arry1(num-10)
else
show1=arry1(num)
end if
end function

function show2(num)
if num=%26gt;10 then
show2=arry2(num-10)
else
show2=arry2(num)
end if
end function

function show3(num)
if num=%26gt;10 then
show3=arry3(num-10)
else
show3=arry3(num)
end if
end function

function show4(num)
if num=%26gt;10 then
show4=arry4(num-10)
else
show4=arry4(num)
end if
end function
--%26gt;
%26lt;/script%26gt;
%26lt;style%26gt;
%26lt;!--
td { font-size:9pt }
--%26gt;
%26lt;/style%26gt;
%26lt;/head%26gt;

%26lt;body onload=%26quot;toplay()%26quot;%26gt;

%26lt;table border=%26quot;0%26quot; cellpadding=%26quot;5%26quot; cellspacing=%26quot;1%26quot;%26gt;
%26lt;tr%26gt;
%26lt;td bgcolor=%26quot;#FFCC66%26quot;%26gt;证券名称%26lt;/td%26gt;
%26lt;td bgcolor=%26quot;#FFCC66%26quot;%26gt;成交%26lt;/td%26gt;
%26lt;td bgcolor=%26quot;#FFCC66%26quot;%26gt;开盘%26lt;/td%26gt;
%26lt;td bgcolor=%26quot;#FFCC66%26quot;%26gt;涨跌%26lt;/td%26gt;
%26lt;/tr%26gt;
%26lt;%
for i=0 to 4
dim bg
bg=%26quot;F0EDE6%26quot;
if i mod 2=0 then bg=%26quot;D2E0F0%26quot;
%%26gt;
%26lt;tr%26gt;
%26lt;td id=%26quot;a%26quot; bgcolor=%26lt;%=bg%%26gt; align=%26quot;right%26quot;%26gt;%26lt;/td%26gt;
%26lt;td id=%26quot;b%26quot; bgcolor=%26lt;%=bg%%26gt; align=%26quot;right%26quot;%26gt;%26lt;/td%26gt;
%26lt;td id=%26quot;c%26quot; bgcolor=%26lt;%=bg%%26gt; align=%26quot;right%26quot;%26gt;%26lt;/td%26gt;
%26lt;td id=%26quot;d%26quot; bgcolor=%26lt;%=bg%%26gt; align=%26quot;right%26quot;%26gt;%26lt;/td%26gt;
%26lt;/tr%26gt;
%26lt;%next%%26gt;
%26lt;/table%26gt;

%26lt;/body%26gt;

%26lt;/html%26gt;

注你可以更改其中的每组显示股票的行数,这里设置的是5个。