[API]新浪股票api调用

本文介绍了如何简单调用新浪股票API,并提及未来可能将其封装为JQuery插件。内容涉及Sina stock API的使用,结合JQuery的$.getScript()方法以及JS的Date.prototype.format功能。还提供了代码示例及CSDN的下载链接。
摘要由CSDN通过智能技术生成

简单的新浪股票API调用

以后有时间,还记得的话,再做成JQuery 插件吧

-----

用到的东西:

1. sina stock API

2. JQuery [$.getScript()]

3. JS [Date.prototype.format]

-----

效果图:

-----

代码:

  1 <!DOCTYPE html>
  2     <head>
  3         <title>CGM003</title>
  4         <script src="js/libs/jquery-1.11.0.js"></script>
  5         <style>
  6         body{
   
  7             font-size:13px;
  8         }
  9         td{
   
 10             padding:1px 2px;
 11             border-bottom:1px solid gray;
 12             text-align:right;
 13             vertical-align:bottom;
 14             white-space:nowrap;
 15         }
 16         .red{
   
 17             color:red;
 18         }
 19         .green{
   
 20             color:green;
 21         }
 22         #infoTbl{
   
 23             font-size:15px;
 24         }
 25         </style>
 26     </head>
 27     <body>
 28         <section>
 29             <header>
 30                 间隔:<input type="number" id="refreshTime" min="100" max="5000" value="1000" />毫秒
 31                 <span id="refresh" style="cursor:pointer; text-decoration:underline; color:blue;"></span>
 32                 <span id="lastTime"></span>
 33                 (字体: <span style="cursor:pointer; text-decoration:underline; color:blue;" onclick="$('#infoTbl').css('font-size','15px');"></span>&nbsp;&nbsp;&nbsp;<span style="cursor:pointer; text-decoration:underline; color:blue;" onclick="$('#infoTbl').css('font-size','20px');"></span>&nbsp;&nbsp;&nbsp;<span style="cursor:pointer; text-decoration:underline; color:blue;" onclick="$('#infoTbl').css('font-size','25px');"></span>&nbsp;&nbsp;&nbsp;<span style="cursor:pointer; text-decoration:underline; color:blue;" onclick="$('#infoTbl').css('font-size','55px');"></span> 34                 <br />
 35                 <select id="market">
 36                     <option value="sh" selected >上海</option>
 37                     <option value="sz" >深圳</option>
 38                 </select>
 39                 代码:
 40                 <input type="text" size="7" id="code" value='' />
 41                 <span style="cursor:pointer; text-decoration:underline; color:blue;" onclick="addStock();">添加</span>
 42             </header>
 43             <article>
 44                 <table id="infoTbl">
 45                 </table>
 46             </article>
 47         </section>
 48         
 49         <script>
 50             // prototype of Date to add [format] meathod
 51 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值