作者:NB联盟-小竹 <HTML xmlns:v><HEAD><STYLE>v\:*{behavior:url(#default#VML);}*{font-size:12px}</STYLE></HEAD><BODY topmargin=0 leftmargin=0 bgcolor=#D7EEFF>
<DIV id=showdiv style="font-size:12px; Color:RED; DISPLAY: none; LEFT: 0px; PADDING-BOTTOM: 2px; PADDING-LEFT: 2px; PADDING-RIGHT: 2px; PADDING-TOP: 2px; POSITION: absolute; TABLE-LAYOUT: fixed; TOP: 0px; WHITE-SPACE: nowrap; Z-INDEX: 500"></DIV><script language="javascript"><!--//加速alt,title的显示var oldtext="abc";
function window.onload(){try{myid2.height=window.document.body.scrollHeight}catch(e){}}
function document.onmousemove(){try{if(event.srcElement.getAttribute('onMOver')){showdiv.style.left=event.x-3;showdiv.style.top=event.y+document.body.scrollTop+18;if(event.srcElement.onMOver!=oldtext){oldtext=event.srcElement.onMOver;showdiv.innerText=oldtext;showdiv.style.backgroundColor='#FFF6FF'};if(showdiv.style.display=='none')showdiv.style.display=''if(showdiv.style.posLeft+300>screen.width){showdiv.style.posLeft=520}}else{if(showdiv.style.display=='')showdiv.style.display='none';}}catch(e){}}//--></SCRIPT>
<?xml:namespace prefix=v /><%'连接数据库set conn=Server.CreateObject("Adodb.Connection")connStr="Provider=SQLOLEDB;Data Source=(local);database=DBName;uid=user;pwd=pass;"conn.Open connStr
'初始化,定义变量BoardID=int(Request("BoardID"))if Request("BoardID")="" then BoardID=1PicWidth=720PicHeight=300
'显示股票列表下拉菜单sql="Select * from Board where BoardID in (Select BoardID From Stocks)"set RsBoard=conn.execute(sql)StockStr="<select onchange=""location.replace('Trend.asp?BoardID='+this.value)"">"do while not RsBoard.eofif RsBoard("BoardID")=BoardID thenChkStr=" selected"elseChkStr=""end ifStockStr=StockStr&"<option value="&RsBoard("BoardID")&ChkStr&">"&RsBoard("BoardName")&"</option>"RsBoard.movenextloopset RsBoard=nothingStockStr=StockStr&"<select>"response.write StockStr
'打开股票走势表sql="Select * from StocksTrend where BoardID="&BoardID&" and CalTime>getDate()-1 and Day(CalTime)=Day(getDate()) order by ID"set rs=Server.CreateObject("Adodb.Recordset")rs.Open sql,conn,1,1
'获取股票价格列表至数组,并计算最高最低价Rec=rs.RecordCountredim Price(Rec)Highest=0Lowest=9999for i=1 to RecPrice(i)=rs("Price")if Price(i)>Highest then Highest=Price(i)if Price(i)<Lowest then Lowest=Price(i)rs.movenextnextset rs=nothing
'画时间点,间隔6小时for i=0 to 24 step 6X=Round(i/24*PicWidth)DrawLine X,PicHeight,X,PicHeight+5,"#808080"PrintWord X,PicHeight+15,i&":00"next
'画走势图边框DrawLine 0,0,PicWidth,0,"#000000"DrawLine 0,0,0,PicHeight,"#000000"DrawLine PicWidth,0,PicWidth,PicHeight,"#000000"DrawLine 0,PicHeight,PicWidth,PicHeight,"#000000"
'画四等分线DrawLine 0,PicHeight*1/4,PicWidth,PicHeight*1/4,"#AAAAAA"DrawLine 0,PicHeight*2/4,PicWidth,PicHeight*2/4,"#AAAAAA"DrawLine 0,PicHeight*3/4,PicWidth,PicHeight*3/4,"#AAAAAA"
'标明四等分线价格PrintWord PicWidth+15, 0/4*PicHeight, FormatNumber(Highest-(Highest-Lowest)*0/4,2,-1,0,0)PrintWord PicWidth+15, 1/4*PicHeight, FormatNumber(Highest-(Highest-Lowest)*1/4,2,-1,0,0)PrintWord PicWidth+15, 2/4*PicHeight, FormatNumber(Highest-(Highest-Lowest)*2/4,2,-1,0,0)PrintWord PicWidth+15, 3/4*PicHeight, FormatNumber(Highest-(Highest-Lowest)*3/4,2,-1,0,0)PrintWord PicWidth+15, 4/4*PicHeight, FormatNumber(Highest-(Highest-Lowest)*4/4,2,-1,0,0)
'画走势图for i=1 to Recif i=1 thenSX=0SY=0elseSX=XSY=Yend ifY=PicHeight-Round((Price(i)-Lowest)/(Highest-Lowest)*PicHeight)X=Round((i-1)*5)DrawPrice SX,SY,X,Y,Price(i),"#000000"next
'自定义函数:画线function DrawLine(SX,SY,X,Y,C)%><v:line style="POSITION:absolute;LEFT:10;TOP:10" from="<%=SX%>,<%=SY%>" to="<%=X%>,<%=Y%>" strokecolor="<%=C%>" strokeweight="1pt"></v:line><%response.write vbcrlfend function
'自定义函数:画线(带alt提示功能)function DrawPrice(SX,SY,X,Y,Price,C)%><v:line onMOver="<%=Price%>" style="POSITION:absolute;LEFT:10;TOP:10" from="<%=SX%>,<%=SY%>" to="<%=X%>,<%=Y%>" strokecolor="<%=C%>" strokeweight="1pt"></v:line><%response.write vbcrlfend function
'显示文本(默认红色)function PrintWord(X,Y,Word)%><SPAN style="LEFT:<%=X%>;TOP:<%=Y%>;COLOR:RED;FONT-FAMILY:宋体;POSITION:absolute"><%=Word%></SPAN><%response.write vbcrlfend function%> |