Bonjour,
Alors voila depuis 2 jours je me casse la tête à propos de ma question. J'explique mon problème :
J'ai un espace membre ou le membre peut ajouter des contacts avec avatars.
J'ai fais en sorte que quand le membre pointe sa souris sur l'avatar de son contact, un <div> s'affiche pour montrer son adresse email, pseudo etc ...
Jusque là pas de problèmes cependant j'aimerais maintenant que le membre puisse supprimer le contact dans le <div>. C'est pourquoi je dois sur le lien "Supprimer ce contact" mettre des variables php que j'appelle avec ma base de donnée mais je n'arrive pas à le faire avec javascript.
Voici le code php que j'utilise pour afficher les contacts du membre.
echo'<div id="des" ></div>';
while ($donnees = mysql_fetch_array($requete))
{
echo '<div class="contact"><img scr="'.$donnees['imgcontactl'].'" onMouseover="showfloatie(\''.$donnees['email'].' \', event)" / ></div>';
}
Explication :
$donnees['imgcontactl'] c'est tout simplement l'url de l'image du contact
onMouseover="showfloatie(\''.$donnees['email'].' \', event)" c'est la fonction qui appelle mon script JS
Voici maintenant le code JS.
var floatiewidth="621px"
var floatieheight="15px"
var floatiebgcolor=""
var fadespeed=70
var baseopacity=0
function slowhigh(which2){
imgobj=which2
browserdetect=which2.filters? "ie" : typeof which2.style.MozOpacity=="string"? "mozilla" : ""
instantset(baseopacity)
highlighting=setInterval("gradualfade(imgobj)",fadespeed)
}
function instantset(degree){
cleartimer()
if (browserdetect=="mozilla")
imgobj.style.MozOpacity=degree/100
else if (browserdetect=="ie")
imgobj.filters.alpha.opacity=degree
}
function cleartimer(){
if (window.highlighting) clearInterval(highlighting)
}
function gradualfade(cur2){
if (browserdetect=="mozilla" && cur2.style.MozOpacity<1)
cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.1, 0.99)
else if (browserdetect=="ie" && cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=10
else if (window.highlighting)
clearInterval(highlighting)
}
function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function paramexists(what){
return(typeof what!="undefined" && what!="")
}
function showfloatie(thetext, e, optbgColor, optWidth, optHeight){
var dsocx=(window.pageXOffset)? pageXOffset: ietruebody().scrollLeft;
var dsocy=(window.pageYOffset)? pageYOffset : ietruebody().scrollTop;
var floatobj=document.getElementById("des")
floatobj.style.display="block"
floatobj.style.backgroundColor=paramexists(optbgColor)? optbgColor : floatiebgcolor
floatobj.style.width=paramexists(optWidth)? optWidth+"px" : floatiewidth
floatobj.style.height=paramexists(optHeight)? optHeight+"px" : floatieheight!=""? floatieheight : ""
floatobj.innerHTML=thetext
var floatWidth=floatobj.offsetWidth>0? floatobj.offsetWidth : floatobj.style.width
var floatHeight=floatobj.offsetHeight>0? floatobj.offsetHeight : floatobj.style.width
var winWidth=document.all&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winHeight=document.all&&!window.opera? ietruebody().clientHeight : window.innerHeight
e=window.event? window.event : e
floatobj.style.left=dsocx+winWidth-floatWidth-5+"px"
if (e.clientX>winWidth-floatWidth && e.clientY+20>winHeight-floatHeight)
floatobj.style.top=dsocy+5+"px"
else
floatobj.style.top=dsocy+winHeight-floatHeight-5+"px"
slowhigh(floatobj)
}
Voila j'espère que vous pourrez m'aider et surtout j'espère avoir été clair