3

我计划运行一个脚本,该脚本使用 PHP 的“file_get_contents”函数从网站中提取股票价格数据,然后使用 jQuery 对其进行操作并作为 iFrame 馈送到第三方网站。

到目前为止,它已成功导入数据,但是 iFrame 太窄,无法显示所有内容。任何人都知道一个简单的 jQuery 文本滚动器,它从右到左循环 div 的内容?

到目前为止的代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ticker</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<style>
.yfi_quote_summary_page{display:none;}
.time_rtq_ticker{font-weight:bolder;}
.down_r{color: #c00;font-weight:bold;}
.up_r{color: #080;font-weight:bold;}
.yfi_rt_quote_summary_rt_top .time_rtq{display:none;}
#time, #currentPrice{float:left;display:inline;font-size:16px;}
#currentPrice p{margin:0;}
#time{margin-right:16px;}
</style>
</head>

<body>
<?php
$content = file_get_contents('http://uk.finance.yahoo.com/q?s=STT.L');
if( $content !== FALSE ) {
  echo $content;
}
?>
<script>
$(function(){
   /*Copy HTML element*/
   var $importedData = $(".yfi_rt_quote_summary_rt_top").clone(true);
   var $time = $(".time_rtq").clone(true);
   $('body').empty();
   $('body').append('<div id="ticker"><div id="time">Stock price at </div><div id="currentPrice"></div></div>');
   $('#currentPrice').append($importedData);
   $('#time').append($time);
});
</script>
</body>
</html>
4

1 回答 1

0

找到了这个网站,它帮助我实现了我正在寻找的东西:http ://remysharp.com/demo/marquee.html

于 2013-06-05T15:13:46.020 回答