0

下面是我从谷歌金融获得的股票报价示例。但它似乎没有工作。股票价格不显示。

谢谢

<body>
Hello world!
Here is your portfolio:<br/>
  GOOG: <span id=_IG_SYM1_l></span> (<span id=_IG_SYM1_c></span>)<br/>
  AAPL: <span id=_IG_SYM2_l></span> (<span id=_IG_SYM2_c></span>)<br/>
  INTC: <span id=_IG_SYM3_l></span> (<span id=_IG_SYM3_c></span>)<br/>


<script type="text/javascript">
  var quote = new google.finance.Quote();
  quote.enableDomUpdates( { 'GOOG' : '_IG_SYM1', 'AAPL' : '_IG_SYM2', 
    'INTC' : '_IG_SYM3' } );

  quote.getQuotes(["GOOG", "AAPL", "INTC"]);
</script>


<!-- start: javascripts -->

<!-- end: javascripts -->
</body>
4

3 回答 3

2

看起来您正在使用http://code.google.com/apis/finance/docs/finance-gadgets.html#JS_API中的示例。如果我理解正确,该 API 仅适用于小工具。它说,

“使用 Market Data API 的小工具只能在 iGoogle 中运行——生产 iGoogle 或 iGoogle 沙箱。”

常规的Google Finance JS API仅允许您获取与用户投资组合相关的数据。

于 2010-02-03T15:45:15.863 回答
0

您可能需要首先对 Google 金融服务进行身份验证。

AuthSubRequest URL 可能如下所示:

https://www.google.com/accounts/AuthSubRequest?
scope=http%3A%2F%2Ffinance.google.com%2Ffinance%2Ffeeds%2F&session=1&secure=0
&next=http%3A%2F%2Fwww.example.com%2Fwelcome.

http://code.google.com/apis/finance/docs/2.0/developers_guide_protocol.html#Authenticating

于 2010-02-03T15:28:33.047 回答
0

您是否尝试过用引号括住 span id 属性?

于 2010-02-03T15:30:54.707 回答