在网页上显示当前股票报价

Display current stock quote on webpage

本文关键字:网页 显示      更新时间:2023-09-26

我想显示BSE&NSE,在我的网页上(使用php)。。。如何实施?请引导我四处走动。

我尝试过这个链接。。。但它并没有显示BSE&NSE。还有其他办法吗?请告诉我。。。

<script>
  function updateQuotes(data) {
   for (ticker in quote) {
    var symbol = quote[ticker];
	
    document.write('<div>Price of ' + ticker + ' : Close -  ' + symbol['Last'] + '</div>');
	document.write('<div>Price of ' + ticker + ' : Low -  ' + symbol['Low'] + '</div>');
	document.write('<div>Price of ' + ticker + ' : High -  ' + symbol['High'] + '</div>');
	document.write('<div>Price of ' + ticker + ' :Open - ' + symbol['Open'] + '</div>');
	
   }
  }
 </script>
 
 <script src="http://feeds.financialcontent.com/JSQuote?Ticker=GOOG"></script>

它之所以没有显示BSE和NSE的市场价格,是因为你在通话中从未要求过它们。

你需要做的是在你的脚本src中定义它们,比如这个

<script src="http://feeds.financialcontent.com/JSQuote?Ticker=GOOG+BSE+NSE"></script>

这将返回正确的数据供updateQoutes解析。

如果你想让它是动态的,你也可以在src属性上用Jquery进行一些字符串替换,但我会让你来解决:)

编辑:仅适用于BSE和NSE

<script src="http://feeds.financialcontent.com/JSQuote?Ticker=BSE+NSE"></script>