allora ... ricapitoliamo ... mi sembra interessante questo script
Bullet Image Link Script
solo che non riesco a farlo funzionare come vorrei io ....
vi posto il codice del file js:
e di quello nella pagina PHP che lo richiama:codice:/*********************************************** * Bullet Link script- © Dynamic Drive DHTML code library (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code ***********************************************/ //Define your bullet image(s) via arbitrary variables, where bulletimg=["imagepath", imagewidth, offsetxfromroot, offsetyfromroot] var ausilio = String(history.previous); //questo è sicuramente sbagliato, era solo una prova var utente = ausilio.slice(ausilio.lastIndexOf("?")+1); var url = String('http://www.ancona5.org/images/userphotos/' + utente + '.jpg'); var bulletimg1=[url, 13, -60, 0]; ////Stop editting here///////////////////// var classnameRE=/(^|\s+)ddbullet($|\s+)/i //regular expression to screen for classname within element function caloffset(what, offsettype){ var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop; var parentEl=what.offsetParent; while (parentEl!=null){ totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop; parentEl=parentEl.offsetParent; } return totaloffset; } function displaybullet(linkobj){ var reltovar=window[linkobj.getAttribute("rel")] bulletobj.setAttribute("src", reltovar[0]) bulletobj.style.left=caloffset(linkobj, "left")-reltovar[1]-reltovar[2]+"px" bulletobj.style.top=caloffset(linkobj, "top")-reltovar[3]+"px" bulletobj.style.visibility="visible" } function modifylinks(){ bulletobj=document.createElement("img") bulletobj.setAttribute("id", "bulletimage") bulletobj.className="bulletimagestyle" document.body.appendChild(bulletobj) for (i=0; i<document.links.length; i++){ if (typeof document.links[i].className=="string" && document.links[i].className.search(classnameRE)!=-1){ document.links[i].onmouseover=function(){displaybullet(this)} document.links[i].onmouseout=function(){bulletobj.style.visibility="hidden"} } } } if (window.addEventListener) window.addEventListener("load", modifylinks, false) else if (window.attachEvent) window.attachEvent("onload", modifylinks) else if (document.getElementById || document.all) window.onload=modifylinks
vedete ... io devo passare al file js il valore $username in modo da caricare nel tooltip l'immagine associata all'utente selezionato. ma purtroppo non so proprio come passare sto valore e metterlo nell'url dell'immagine da caricare!!Codice PHP:$retval .= '<SCRIPT src="http://www.ancona5.org/javascript/user_image.js" type="text/javascript"><!--
//--></SCRIPT>
<a href="http://www.ancona5.org/images/userphotos/' . $username . '.jpg?' . $username .'" class="ddbullet" rel="bulletimg1">
<img src="' . $_CONF['layout_url']
. '/images/smallcamera.' . $_IMAGE_TYPE
. '" border="0" alt=""></a>';
nonostante gli altri post sempre su questo argomento, non riesco a cavarci niente di buono!
ps: vi ricordo che io il javascript è la prima volta che lo vedo scritto![]()

Rispondi quotando
