<?php
    function load_file($url) { 
        $ch = curl_init($url); 
        // Return http response in string   
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
        $xml = simplexml_load_string(curl_exec($ch));   
        return $xml;
    }
    function cbTimeSet($cbtime){
        date_default_timezone_set('Asia/Shanghai');
        $pubDate = date('Y-m-d H:i:s', strtotime($cbtime));
        return $pubDate;
    }
    //$feedurl = 'http://rss.sina.com.cn/news/china/focus15.xml';  
	$feedurl = 'http://joke.qq.com/fool/rss_fool.xml';
    $rss = load_file($feedurl);
?>

<!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" xml:lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<META HTTP-EQUIV="pragma" CONTENT="no-cache">
	<META HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate">
	<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
	<META HTTP-EQUIV="expires" CONTENT="0">
	<meta http-equiv= "refresh" content= "300000" /> 
    <title></title>
    <base target="_blank" />
    <script type="text/javascript" src="jquery-1.4.4.min.js"></script>
    <style>
	*{ margin:0; padding:0;}
	.scrollDiv {
		height: 23px;
		overflow: hidden;
		margin: 0;
		padding: 0;
	}
	.scrollDiv ul {
		margin: 0;
		padding: 0;
		list-style:none;
	}
	.scrollDiv ul li {
		font-size: 12px;
		line-height: 23px;
		height: 23px;		
		margin: 0;
		padding: 0 0 0 8px;
		width:190px;
		overflow: hidden;
    	text-overflow: ellipsis;/*文字隐藏后添加省略号*/
    	white-space: nowrap;/*强制不换行*/
    
    
	}
	h2{ font-size:14px; color:#0a57a3; height:20x; line-height:20px; margin:0; padding:0 0 5px 8px;}
	.scrollDiv ul li a{ color:#0a57a3; text-decoration:none;}
	.scrollDiv ul li a:hover{ text-decoration:underline; color:#f60;}
	</style>
    </head>
    <body>

<div class="scrollDiv" id="s2">

      <ul>
    <?php 	
    foreach ($rss->channel->item as $item) {       
        echo "<li>"."<a href=". $item->link .">" . $item->title . "</a></li>";        
    }	
    echo $rss;
	?>
  </ul>
    </div>
<script type="text/javascript">
	
	(function($){
		$.fn.extend({
			Scroll:function(opt,callback){
					
					if(!opt) var opt={};
					var _this=this.eq(0).find("ul:first");
					var lineH=_this.find("li:first").height(), 
						line=opt.line?parseInt(opt.line,10):parseInt(this.height()/lineH,10),
						speed=opt.speed?parseInt(opt.speed,10):500, 
						timer=opt.timer?parseInt(opt.timer,10):3000; 
					if(line==0) line=1;
					var upHeight=0-line*lineH;
					
					scrollUp=function(){
							_this.animate({
									marginTop:upHeight
							},speed,function(){
									for(i=1;i<=line;i++){
											_this.find("li:first").appendTo(_this);
									}
									_this.css({marginTop:0});
							});
					}
					
					_this.hover(function(){
							clearInterval(timerID);
					},function(){
							timerID=setInterval("scrollUp()",timer);
					}).mouseout();
			}       
		});
	})(jQuery);
	
	$(document).ready(function(){
		$("#s2").Scroll({line:1,speed:600,timer:12000});
	});
	</script>
</body>
</html>
