引用股票图的代码

程序代码 程序代码
<script language="javascript">
//默认加载股票行情代码
window.onload=function(){
queryStock('000001');
}
   var currentStockCode = "";
   var stockListDisplay = false;
  
   function linkToStockView(stockCode){
   currentStockCode = stockCode;
   var kimageurl = "http://stockimg.sina.com.cn/newchart/daily/"+stockCode+".gif";
   var priceurl = "http://fchart.sina.com.cn/newchart/min/"+stockCode+".gif";
   window.kimageframe.location.href = kimageurl;
   window.priceframe.location.href = priceurl;
   linksina.style.display = "inline";
   window.scroll(0, 0);
   }
  
   function queryStock(stockCode){
   //var stockCode = stock_code.value;
   if(stockCode==""){
   alert("输入的股票代码为空!");
   return;
   }
   var codePref = stockCode.substring(0,1);
   if(codePref=="0"){ //深市
   stockCode = "sz"+stockCode;
   linkToStockView(stockCode);
   }else if(codePref=="6"){ //沪市
   stockCode = "sh"+stockCode;
   linkToStockView(stockCode);
   }else{
   alert("请输入正确的股票代码!");
   }
   }
  
   function linkSina(){
   var linkurl = "";
   if(currentStockCode!=""){
   linkurl = "http://finance.sina.com.cn/realstock/company/"+currentStockCode+"/kline.shtml?daily";
   window.open(linkurl);
   }else{
   alert("系统不能确定查询的股票!");
   }
   }  
   function displayStockList(){
   if(stockListDisplay){
   stocklist.style.display="none"
   stockListDisplay = false;
   }else{
   stocklist.style.display="inline"
   stockListDisplay = true;
   }
   }  
  </script>
<table id="querystock" width="40%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>沪深A股代码 <input type="text" name="stock_code" value="" size="10"><input type="button" name="query_button" value="查询" onClick="queryStock(stock_code.value)"> </td>
  </tr>
</table>
<table id="stockview" width="90%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><iframe id="kimageframe" align="left" frameborder="0" scrolling="no" width="500px" height="300px;">    </iframe></td>
    <td><iframe id="priceframe" align="left" frameborder="0" scrolling="no" width="500px" height="300px;"></iframe></td>
  </tr>
</table>

<table id = "linksina" style="display:none">
   <tr>
   <td width="30%">  </td>
   <td width="40%" align="center" >
   <input type="button" name="urlbutton" value="详细行情>>" onClick="linkSina()"> </td>
   <td width="30%">  </td>
   </tr>
  </table>
  
  <table width="90%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><input name="stocklisttiltle" type="button" value="部分股票列表" onClick="displayStockList()"></td>
  </tr>
  <tr>
    <td><hr></td>
  </tr>
</table>  
  <!-- 可以按下面的格式添加自己需要的股票,也可以删除其中不需要的 -->
  <table id="stocklist" border="1" style="display:none" >
  <tr><td onClick="queryStock('600037')">G歌华 600037</td></tr>
  <tr><td onClick="queryStock('600036')">G招行 600036 </td></tr>
  <tr><td onClick="queryStock('600016')">G民生(上海,600016)</td></tr>
  <tr><td onClick="queryStock('600138')">G中青旅 600138 </td></tr>
  <tr><td onClick="queryStock('600258')">首旅股份(上海,600258)</td></tr>
  <tr><td onClick="queryStock('000912')">G泸天化(深圳,000912)</td></tr>
  <tr><td onClick="queryStock('600528')">G中铁(上海,600528)</td></tr>
  <tr><td onClick="queryStock('000568')">G老窖(深圳,000568)</td></tr>
  <tr><td onClick="queryStock('600663')">G陆家嘴(上海,600663)</td></tr>
  <tr><td onClick="queryStock('600007')">中国国贸(上海,600007)</td></tr>
  </table>



[本日志由 winxml 于 2009-04-23 05:25 PM 编辑]
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
相关日志:
评论: 0 | 引用: 0 | 查看次数: -
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.