1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
| // ---------------------------------
// Galerie === place_diapo()
// ---------------------------------
function charge_galerie(arg) {
objxhr = xhr_connect()
if (objxhr) {
objxhr.onreadystatechange = function() {
if (objxhr.readyState == 4) {
if (objxhr.status == 200) {
//alert(objxhr.responseText)
reset_galerie()
retour = objxhr.responseXML
place_galerie(retour)
}
}
}
sql = "ch_img_rubId=" + arg;
objxhr.open("POST", "charge_galerie.php", true)
objxhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
objxhr.send(sql)
} else {
alert("Soucis d'xmlHttpRequest")
}
}
function reset_galerie() {
pc = document.getElementById('planche-contact')
while (pc.firstChild) {
pc.removeChild(pc.firstChild)
}
}
function place_galerie(arg) {
diapos = arg.getElementsByTagName('image')
nb_diapo = diapos.length
for (i=0; i<nb_diapo;i++) {
dia_temp = diapos[i]
img = dia_temp.getElementsByTagName('ch_img_fichier')[0].firstChild.nodeValue
infos = dia_temp.getElementsByTagName('ch_img_id')[0].firstChild.nodeValue
folder = dia_temp.getElementsByTagName('ch_img_rubId')[0].firstChild.nodeValue
orientation = dia_temp.getAttribute('orientation')
place_diapo(img, infos, folder, orientation)
}
}
// ---------------------------------
// Diapositives
// ---------------------------------
function place_diapo(arg, src, folder, orientation) {
pc =document.getElementById('planche-contact')
div = document.createElement('div')
img = document.createElement('img')
img.alt = folder
img.className = orientation
img.src = "images/"+folder+"/thumbs/"+arg
div.appendChild(img)
div.src = src
div.onclick = function() {
//alert(this.src)
searchInfos(this.src)
}
pc.appendChild(div)
}
// ---------------------------------
// OBJET XML HTTP Request
// ---------------------------------
function xhr_connect() {
xhr = false
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest
} else if (window.ActiveXObject) {
reussi = false
iexhr = new Array("Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0",
"Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP",
"Microsoft.XMLHTTP")
for (i=0; i<iexhr.length && ! reussi; i++) {
try {
xhr = new ActiveXObject(iexhr[i])
} catch(e) {}
}
}
return xhr;
} |
Partager