a questo punto posso solo fare copia/incolla della pagina di esempio sperando ti sia d' aiuto
poi, un consiglio, se questo script lo vuoi studiare per scopi didattici lo troverai interessante, ma lo stesso effetto e' ottenibile in maniera molto piu' pulita con il solo uso dei csscodice:<!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" lang="it"> <head> <title>Link con immagine - Esempio JavaScript scaricato da HTML.it</title> <meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Language" content="it" /> <meta name="Robots" content="All" /> <meta name="Description" content="HTML.it - il sito italiano sul Web publishing" /> <meta name="Keywords" content="Lo script permette di associare un'immagine ai link." /> <meta name="Owner" content="HTML.it srl" /> <meta name="Author" content="HTML.it srl" /> <meta name="Copyright" content="HTML.it srl" /> <script type="text/javascript"> //Write out bullet image. var bulletimg='[img]x.gif[/img]' var bulletoffX=2 //Set horizontal offset of bullet image from link's root. (ie: -2 or 5) var bulletoffY=0 //Set vertical offset of bullet image from link's root. (ie: -2 or 5) 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){ bulletobj.style.left=caloffset(linkobj, "left")-bulletobj.width-bulletoffX+"px" bulletobj.style.top=caloffset(linkobj, "top")-bulletoffY+linkobj.offsetHeight/3+"px" bulletobj.style.visibility="visible" } function modifylinks(){ bulletobj=document.all? document.all.bullet : document.getElementById("bullet") for (i=0; i<document.links.length; i++){ if (document.links[i].className=="ddbullet"){ document.links[i].onmouseover=function(){displaybullet(this)} document.links[i].onmouseout=function(){bulletobj.style.visibility="hidden"} } } } if (document.all || document.getElementById) document.write(bulletimg) 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 </script> </head> <body > <div align="center"> HTML.it FREEPHP FORUM </div> <div align="center"> [img]logo_htmlit.gif[/img] </div> </body> </html>
ciao

Rispondi quotando