HI
I need to make a HTML banner that displays a scrolling RSS feed, i can get it to work just fine i IE, but Chrome and FF doesn't recieve the RSS data
The link : http://www.it-jobbank.dk/nyhedsbreve...ss_banner.html
The code
Quote:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style>
a{
font-family:verdana;
font-size:12px;
line-height:15px;
color:#000000;
/*text-decoration:none;*/
}
</style>
<?php
// PHP Proxy
// Loads a XML from any location. Used with Flash/Flex apps to bypass security restrictions
// Author: Paulo Fierro
// January 29, 2006
// usage: proxy.php?url=http://mysite.com/myxml.xml
$session = curl_init($_GET['url']); // Open the Curl session
curl_setopt($session, CURLOPT_HEADER, false); // Don't return HTTP headers
curl_setopt($session, CURLOPT_RETURNTRANSFER, true); // Do return the contents of the call
$xml = curl_exec($session); // Make the call
header("Content-Type: text/xml"); // Set the content type appropriately
echo $xml; // Spit out the xml
curl_close($session); // And close the session
?>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>RSS Reader</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script>
var html = "";
var test = "'";
var temp =""
function get_rss_feed() {
//jQuery(document).ready(function(){
//clear the content in the div for the next feed.
html ="<div style='position:relative;top:35px;left:5px;height: 200px;width:290px;background-color:yellow;overflow: auto;'>"
//use the JQuery get to grab the URL from the selected item, put the results in to an argument for parsing in the inline function called when the feed retrieval is complete
$.get("http://www.it-jobbank.dk/Rss.aspx?feed=latest20jobs", function(d) {
//find each 'item' in the file and parse it
$(d).find('item').each(function() {
//name the current found item this for this particular loop run
var $item = $(this);
var title = $item.find('title').text();
var link = $item.find('link').text();
var description = $item.find('description').text();
var pubDate = $item.find('pubDate').text();
test += "<a href=\""+ link + "\" target=\"_blank\">" + title+ "<\/a><\/br>";
//put that feed content on the screen!
});
test = test +"'";
$('#inner').append($(test));
});
};
/************************************************** *************************************/
//ENTER CONTENT TO SCROLL BELOW.
var boxheight=175; // BACKGROUND BOX HEIGHT IN PIXELS.
var boxwidth=280; // BACKGROUND BOX WIDTH IN PIXELS.
var boxcolor="#FFF6e9"; // BACKGROUND BOX COLOR.
var speed=75; // SPEED OF SCROLL IN MILLISECONDS (1 SECOND=1000 MILLISECONDS)..
var pixelstep=2; // PIXELS "STEPS" PER REPITITION.
var godown=false; // TOP TO BOTTOM=TRUE , BOTTOM TO TOP=FALSE
// DO NOT EDIT BEYOND THIS POINT
var outer,inner,elementheight,ref,refX,refY;
var w3c=(document.getElementById)?true:false;
var ns4=(document.layers)?true:false;
var ie4=(document.all && !w3c)?true:false;
var ie5=(document.all && w3c)?true:false;
var ns6=(w3c && navigator.appName.indexOf("Netscape")>=0)?true:fal se;
var txt='';
// }
function getElHeight(el){
if(ns4)return (el.document.height)? el.document.height : el.clip.bottom-el.clip.top;
else if(ie4||ie5)return (el.style.height)? el.style.height : el.clientHeight;
else return (el.style.height)? parseInt(el.style.height) arseInt(el.offsetHeight );
}
function getPageLeft(el){
var x;
if(ns4)return el.pageX;
if(ie4||w3c){
x = 0;
while(el.offsetParent!=null){
x+=el.offsetLeft;
el=el.offsetParent;
}
x+=el.offsetLeft;
return x;
}}
function getPageTop(el){
var y;
if(ns4)return el.pageY;
if(ie4||w3c){
y=0;
while(el.offsetParent!=null){
y+=el.offsetTop;
el=el.offsetParent;
}
y+=el.offsetTop;
return y;
}}
function scrollbox(){
//alert(elementheight)
if(ns4){
inner.top+=(godown)? pixelstep: -pixelstep;
if(godown){
if(inner.top>boxheight)inner.top=-elementheight;
}else{
if(inner.top<2-elementheight)inner.top=boxheight+2;
}
}else{
inner.style.top=parseInt(inner.style.top)+((godown )? pixelstep: -pixelstep)+'px';
if(godown){
if(parseInt(inner.style.top)>boxheight)inner.style .top=-elementheight+'px';
}else{
if(parseInt(inner.style.top)<2-elementheight)inner.style.top=boxheight+2+'px';
}
//alert(elementheight);
}
}
window.onresize=function(){
if(ns4)setTimeout('history.go(0)', 400);
else{
outer.style.left=getPageLeft(ref)+'px';
}}
window.onload=function(){
//get_rss_feed()
outer=(ns4)?document.layers['outer']: (ie4)?document.all['outer']:document.getElementById('outer');
inner=(ns4)?outer.document.layers['inner']: (ie4)?document.all['inner']:document.getElementById('inner');
ref=(ns4)?document.layers['ref']: (ie4)?document.all['ref']:document.getElementById('ref');
elementheight=getElHeight(inner);
if(ns4){
outer.moveTo(getPageLeft(ref),getPageTop(ref));
outer.clip.width=boxwidth;
outer.clip.height=boxheight;
inner.top=(godown)? -elementheight : boxheight-2;
inner.clip.width=boxwidth-4;
inner.clip.height=elementheight;
outer.visibility="show";
inner.visibility="show";
}else{
outer.style.left=getPageLeft(ref)+'px';
inner.style.top= ((godown)? -elementheight : boxheight)+'px';
inner.style.clip='rect(0px, '+(boxwidth-4)+'px, '+(elementheight)+'px, 0px)';
outer.style.visibility="visible";
}
setInterval('scrollbox()',speed);
}
/************************************************** *************************************/
</script>
</head>
<body style="background-color:red;">
<div id="ref" style="position:relative; width:'300'; height:'250';background-image:url(http://www.it-jobbank.dk/nyhedsbreve/banner/300x250jobticker.jpg);" ></div>
<div id="outer" style="position:absolute;top:52px;width:'300'; height:175px; visibility:hidden; overflow:hidden;" >
<div id="inner" style="position:absolute; visibility:visible; left:2px; top:2px; width:288px;overflow:hidden; cursor:default;"></div>
</div>
</body>
</html>
|
Last edited by rene.lintrup; 05-18-2010 at 05:40 AM..
|