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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
| function getXMLHTTP(){
var xhr = null;
if(window.XMLHttpRequest)
{ // Firefox et autres
xhr = new XMLHttpRequest();
}
else if(window.ActiveXObject)
{ // Internet Explorer
try
{
xhr = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e1)
{
xhr = null;
}
}
}
else
{ // XMLHttpRequest non supporté par le navigateur
alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
}
return xhr;
}
//Objet XMLHTTPRequest
var XHR = null;
function detail_bulle(obj,eltname){
//Si l'objet existe déjà on abandonne la requête et on le supprime
if(XHR && XHR.readyState != 0)
{
XHR.abort();
delete XHR;
}
//Création de l'objet XMLHTTPRequest
XHR = getXMLHTTP();
if(!XHR)
{
return false;
}
XHR.open("GET","detail_bulle.php?ivalue=" + obj.value + "&iname=" + eltname, true);
XHR.onreadystatechange = function()
{
if (XHR.readyState == 4)
{
if(bal){
bulle.removeChild(bal);
bal=false;
};
bal=document.createElement('div');
bal.style.fontWeight=100;
bal.style.backgroundColor="white";
bal.style.border="solid";
var chaine=XHR.responseText;
bal2=document.createTextNode(chaine);
bal.appendChild(bal2);
bulle.appendChild(bal);
if(chaine=="Aucun"){
bulle.removeChild(bal);
bal=false;
};
}
};
XHR.send(null);
}
document.write('<div style="position:absolute;display:none" id="bulle"></div>')
var bal=false;
var bulle=document.getElementById('bulle');
var detail = '';
nom ='';
function on(e){
if(!e){
window.event.cancelBubble=true
}
else{
e.stopPropagation()
};
//position de la bulle
if(this.name){
nom = this.name;
} else {
ns= (navigator.appName.search("Nestcape")!=-1) ? window.pageXOffset : 0;
ns2= (navigator.appName.search("Nestcape")!=-1) ? window.pageYOffset : 0;
posx= (!e) ? event.clientX+document.documentElement.scrollLeft : e.pageX+ns;
posy= (!e) ? event.clientY+document.documentElement.scrollTop : e.pageY+ns2;
hori=(posx > (screen.availWidth - 200)) ? -250 : 0;
bulle.style.left= posx+hori+"px";
bulle.style.top= posy+"px";
bulle.style.display="block";
detail_bulle(this,nom);
}
}
function off(e){
if(!e){
window.event.cancelBubble=true
}else{
e.stopPropagation()
};
bulle.style.display='none';
if(bal){
bulle.removeChild(bal);
bal=false;
};
}
var tagtype=new Array('OPTION','SELECT');
var expl=new Array('image','contenant de type bloc','paragraphe','formulaire',
'titre n°1','tableau','cellule de tableau','lien','contenant intra-ligne',
'contrôle de formulaire','zone de texte multiligne','barre horizontale',
'titre n°2','liste d\'options');
var tags=new Array();
for(i=0;i != tagtype.length;i++){
tags[tagtype[i]]=expl[i]
}
for(i=0;i != tagtype.length;i++){
for(j=0;j != document.getElementsByTagName(tagtype[i]).length;j++)
{
document.getElementsByTagName(tagtype[i])[j].onmouseover=on;
document.getElementsByTagName(tagtype[i])[j].onmouseout=off;
};
}
document.body.onclick=off; |
Partager