function displayRSS(URI,myid,mytag,mynb) { var xmlhttp=false; var mydiv = document.getElementById(myid); /*@cc_on @*/ /*@if (@_jscript_version >= 5) // JScript gives us Conditional compilation, we can cope with old IE versions. // and security blocked creation of the objects. try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @end @*/ if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); } xmlhttp.open("GET", URI,true); mytag = document.createElement("p"); mytag.setAttribute('align','center'); image = document.createElement('img'); image.setAttribute('border','0'); image.src = '../wait.gif'; mytag.appendChild(image); mydiv.appendChild(mytag); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { xmlDoc=xmlhttp.responseXML; items=xmlDoc; formatRSS(); } } xmlhttp.send(null); function formatRSS() { var items_count=items.getElementsByTagName('item').length; if(mynb < items_count){items_count = mynb;} if(items_count == 0) { ptag = document.createElement("p"); ptag.appendChild(document.createTextNode("Ce flux ne semble pas être valide ou est actuellement indisponible")); mydiv.appendChild(ptag); return; } //titre var titre = items.getElementsByTagName('title')[0].firstChild.nodeValue; var link = items.getElementsByTagName('link')[0].firstChild.nodeValue; span = document.createElement("div"); span.style.padding = "10px"; span.style.margin = "5px"; span.style.width = "175px"; span.style.border = "1px "+document.bgColor+" solid"; mydiv.appendChild(span); h4 = document.createElement("h4"); h4.appendChild(document.createTextNode(titre)); span.appendChild(h4); //contenu var ptag = '
'; for(var i=0; i75) articleTitle = articleTitle.substring(0,75) + '...'; linktag = document.createElement("a"); linktag.setAttribute("href",articleURL); linktag.setAttribute("class","gris_b"); linktag.setAttribute("className","gris_b"); linktag.setAttribute("target","_blank"); linktag.setAttribute("title",""+articleDesc+""); linktag.appendChild(document.createTextNode(articleTitle)); litag = document.createElement("li"); litag.appendChild(linktag); span.appendChild(litag); } ptag += '
'; if(link.search(/flickr/)!=-1){mydiv.innerHTML = ptag;} else {mydiv.removeChild(mytag);} } }