Citation:
<?xml version="1.0" encoding="iso-8859-2"?>
<!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="cs" lang="cs">
<head>
<meta name="generator" content="PSPad editor, www.pspad.com" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2" />
<script src="diaporama.js">
</script>
<title>Untitled</title>
<link rel="stylesheet" href="diaporama.css" type="text/css">
</head>
<body onload="Diaporama();">
<div id="Ecran">
</div>
<xml id="dsoDiaporama" src="diaporama.xml"></xml>
<div id=Legende>
</div>
</body>
</html>
feuille js
Citation:
/ JavaScript Document
var Delai=5 // délai d'affichage en seconde
var CompteurTransition=0;
function Diaporama()
{
Document=dsoDiaporama.XmlDocument;
var NbDiapo = Document.documentElement.childNodes.length;
var CompteurDiapo=0;
//initialise l'image de 'écran
var e =document.getElementById("Ecran");
var z=document.createElement("img");
z.setAttribute("id","ImageDiapo");
z.setAttribute("src","Photos/p0.jpg");
e.appendChild(z);
Delai=Delai*1000;// transforme en millseconde
Afficher(CompteurDiapo,NbDiapo);
}
// fonction d'affichage des diapos
function Afficher(CompteurDiapo,NbDiapo)
{
CompteurDiapo=CompteurDiapo+1;
Document=dsoDiaporama.XmlDocument;
var e=document.getElementById("ImageDiapo");
var Adresse=Document.documentElement.childNodes(CompteurDiapo).childNodes(0).text;
e.setAttribute("src",Adresse);
if(CompteurDiapo>=NbDiapo-1)
{
CompteurDiapo=0;
}
//Transition();
var TimerDiapo=window.setTimeout("Afficher("+CompteurDiapo +","+NbDiapo+")",Delai);
}
function Transition()
{
CompteurTransition = CompteurTransition +1;
var e =document.getElementById("ImageDiapo");
e.style.filter="Alpha(opacity="+CompteurTransition+ ", style="+0+")";
if(CompteurTransition>=100)
{
TimerTransition="";
CompteurTransition=0;
}
else
{
varTimerTransition=window;setTimeout("Transition()",20);
}
}
feuille xml
Citation:
<?xml version="1.0" encoding="windows-1250"?>
<diaporama>
<photo>
<adresse>Photos/p0.jpg</adresse>
<texte>hh</texte>
</photo>
<photo>
<adresse>Photos/p1.jpg</adresse>
<texte></texte>
</photo>
<photo>
<adresse>Photos/p2.jpg</adresse>
<texte>Photos/p0.jpg</texte>
</photo>
<photo>
<adresse>Photos/p3.jpg</adresse>
<texte>Photos/p0.jpg</texte>
</photo>
<photo>
<adresse>Photos/p4.jpg</adresse>
<texte></texte>
</photo>
</diaporama>