Web Service 介面
阿新 • • 發佈:2018-12-25
<% @ page language = " java " contentType = " text/html; charset=UTF-8 " pageEncoding = " UTF-8 " %>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
<%
String stockId = request.getParameter( " stockId " );
if (stockId == null ) {
stockId = " 000001 " ;
}
%>
< html >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=UTF-8" />
< title > 股票查詢結果 </ title >
< link href ="<%=request.getContextPath() %>/css/style.css" type ="text/css" rel ="stylesheet" >
< script type ="text/javascript" src ="http://hq.sinajs.cn/list=s_sh<%=stockId %>" charset ="gb2312" ></script >
< meta http-equiv ="pragma" content ="no-cache" >
< meta http-equiv ="cache-control" content ="no-cache" >
< meta http-equiv ="expires" content ="0" >
</ head >
< body onload ="" >
< div class ="bodyDiv" >
< table >
< tr >
< td colspan ="2" valign ="bottom" align ="left"
style="width:176px; background: url(<%=request.getContextPath() %>/images/line2_bg.gif) repeat-x;border-bottom: 1px solid #b0bec7;"
height ="19" >
< span class ="titleFont" >
< font class ="newTitleFont" >< b > 股票查詢結果 </ b ></ font >
</ span >
</ td >
</ tr >
< tr >
< td > 指數名稱: </ td >
< td >< span id ="stockName" > </ span ></ td >
</ tr >
< tr >
< td > 當前點數: </ td >
< td >< span id ="currentPoint" > </ span ></ td >
</ tr >
< tr >
< td > 當前價格: </ td >
< td >< span id ="currentPrice" > </ span ></ td >
</ tr >
< tr >
< td > 漲跌率: </ td >
< td >< span id ="ratio" > </ span ></ td >
</ tr >
< tr >
< td > 成交額(w): </ td >
< td >< span id =turnVolume > </ span ></ td >
</ tr >
< tr >
< td colspan ="2" valign ="bottom" align ="right"
style="width:176px; background: url(<%=request.getContextPath() %>/images/line2_bg.gif) repeat-x;border-bottom: 1px solid #b0bec7;"
height ="19" >
< span class ="titleFont" >
< font class ="newTitleFont" >< b > 1日K線 0返回 </ b ></ font >
</ span >
</ td >
</ tr >
</ table >
</ div >
< script language ="javascript" >
<!--
// 查詢結果的格式為:指數名稱,當前點數,當前價格,漲跌率,成交量(手),成交額(萬元)
// 解析字串
var stockValue = hq_str_s_sh <%= stockId %> ;
var stockArray = stockValue.split( " , " );
document.getElementById( " stockName " ).innerText = stockArray[ 0 ];
document.getElementById( " currentPoint " ).innerText = stockArray[ 1 ];
document.getElementById( " currentPrice " ).innerText = stockArray[ 2 ];
document.getElementById( " ratio " ).innerText = stockArray[ 3 ];
document.getElementById( " turnVolume " ).innerText = stockArray[ 5 ];
-->
</ script >
</ body >
</ html >
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
<%
String stockId = request.getParameter( " stockId " );
if (stockId == null ) {
stockId = " 000001 " ;
%>
< html >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=UTF-8" />
< title > 股票查詢結果 </ title >
< link href ="<%=request.getContextPath() %>/css/style.css" type ="text/css" rel ="stylesheet" >
< script type ="text/javascript" src ="http://hq.sinajs.cn/list=s_sh<%=stockId %>" charset ="gb2312" ></script >
< meta http-equiv ="pragma" content ="no-cache" >
< meta http-equiv ="cache-control" content ="no-cache" >
<
</ head >
< body onload ="" >
< div class ="bodyDiv" >
< table >
< tr >
< td colspan ="2" valign ="bottom" align ="left"
style="width:176px; background: url(<%=request.getContextPath() %>/images/line2_bg.gif) repeat-x;border-bottom: 1px solid #b0bec7;"
height ="19" >
< span class ="titleFont" >
< font class ="newTitleFont" >< b > 股票查詢結果 </ b ></ font >
</ span >
</ td >
</ tr >
< tr >
< td > 指數名稱: </ td >
< td >< span id ="stockName" > </ span ></ td >
</ tr >
< tr >
< td > 當前點數: </ td >
< td >< span id ="currentPoint" > </ span ></ td >
</ tr >
< tr >
< td > 當前價格: </ td >
< td >< span id ="currentPrice" > </ span ></ td >
</ tr >
< tr >
< td > 漲跌率: </ td >
< td >< span id ="ratio" > </ span ></ td >
</ tr >
< tr >
< td > 成交額(w): </ td >
< td >< span id =turnVolume > </ span ></ td >
</ tr >
< tr >
< td colspan ="2" valign ="bottom" align ="right"
style="width:176px; background: url(<%=request.getContextPath() %>/images/line2_bg.gif) repeat-x;border-bottom: 1px solid #b0bec7;"
height ="19" >
< span class ="titleFont" >
< font class ="newTitleFont" >< b > 1日K線 0返回 </ b ></ font >
</ span >
</ td >
</ tr >
</ table >
</ div >
< script language ="javascript" >
<!--
// 查詢結果的格式為:指數名稱,當前點數,當前價格,漲跌率,成交量(手),成交額(萬元)
// 解析字串
var stockValue = hq_str_s_sh <%= stockId %> ;
var stockArray = stockValue.split( " , " );
document.getElementById( " stockName " ).innerText = stockArray[ 0 ];
document.getElementById( " currentPoint " ).innerText = stockArray[ 1 ];
document.getElementById( " currentPrice " ).innerText = stockArray[ 2 ];
document.getElementById( " ratio " ).innerText = stockArray[ 3 ];
document.getElementById( " turnVolume " ).innerText = stockArray[ 5 ];
-->
</ script >
</ body >
</ html >