Ho modificato cosi
codice:
function loadinterfacciasharing(link)
{
if(type_sharing==-1){
return 0;
}
var xmlhttp;
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
//document.getElementById("sharing").innerHTML=xmlhttp.responseText;
var fine = execJS(xmlhttp.responseText);
document.getElementById("sharing").innerHTML=fine;
}
}
xmlhttp.open("GET","media_sharing_response.php?link="+link+"&r="+type_sharing,true);
xmlhttp.send();
}
function execJS(t)
{
var p1 = 0, p2 = 0, p3 = 0, p4 = 0;
p1 = t.indexOf("<" + "script", 0);
if(p1 == -1) return t;
p2 = t.indexOf(">", p1 + 7) + 1;
p3 = t.indexOf("<" + "/script>", p2);
p4 = p3 + 9;
var c = t.substring(p2, p3);
var s = document.createElement("script");
s.type = "text/javascript";
s.text = c;
document.getElementsByTagName("head")[0].appendChild(s);
t = t.substring(0, p1) + t.substr(p4);
return execJS(t);
}
Ma il javascript viene visualizzato come testo
codice:
var myInterfacce = new Array(); function loading_previews(){myInterfacce[0] = "http://i.ytimg.com/vi/K1uNjmxJQUo/0.jpg";myInterfacce[1] = "http://i.ytimg.com/vi/K1uNjmxJQUo/1.jpg";myInterfacce[2] = "http://i.ytimg.com/vi/K1uNjmxJQUo/2.jpg";} var scegli_preview = 1; function alternativa_anteprima(){ if(scegli_preview < 0 || scegli_preview > 2 ) { scegli_preview = 0; } scegli_preview++; if(scegli_preview > 2) scegli_preview = 0; document["image_revview"].src = myInterfacce[scegli_preview]; document.getElementById('current_anteprima').innerHTML = "(Anteprima attuale: "+scegli_preview+")"; } window.onload = loading_previews()