• User Attivo

    problema di dhtml

    Ho avuto un piccolo problema con il dhtml.
    Stavo pensando se era possibile far si che quando un utente "raggiunga" con il mouse una parola, in un punto precisato della pagina appaia una didascalia da me scritta...
    Ho provato a mettere insieme target e onmouseover, ma non mi son venuti risultati... come fare?


  • Super User

    Usa dei layer o meglio dei div dei quali cambi la visibilità con javascript.
    Ecco un esempio creato al volo con Dreamweaver

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_reloadPage&#40;init&#41; &#123;  //reloads the window if Nav4 resized
      if &#40;init==true&#41; with &#40;navigator&#41; &#123;if &#40;&#40;appName=="Netscape"&#41;&&&#40;parseInt&#40;appVersion&#41;==4&#41;&#41; &#123;
        document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; &#125;&#125;
      else if &#40;innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH&#41; location.reload&#40;&#41;;
    &#125;
    MM_reloadPage&#40;true&#41;;
    
    function MM_findObj&#40;n, d&#41; &#123; //v4.01
      var p,i,x;  if&#40;!d&#41; d=document; if&#40;&#40;p=n.indexOf&#40;"?"&#41;&#41;>0&&parent.frames.length&#41; &#123;
        d=parent.frames&#91;n.substring&#40;p+1&#41;&#93;.document; n=n.substring&#40;0,p&#41;;&#125;
      if&#40;!&#40;x=d&#91;n&#93;&#41;&&d.all&#41; x=d.all&#91;n&#93;; for &#40;i=0;!x&&i<d.forms.length;i++&#41; x=d.forms&#91;i&#93;&#91;n&#93;;
      for&#40;i=0;!x&&d.layers&&i<d.layers.length;i++&#41; x=MM_findObj&#40;n,d.layers&#91;i&#93;.document&#41;;
      if&#40;!x && d.getElementById&#41; x=d.getElementById&#40;n&#41;; return x;
    &#125;
    
    function MM_changeProp&#40;objName,x,theProp,theValue&#41; &#123; //v6.0
      var obj = MM_findObj&#40;objName&#41;;
      if &#40;obj && &#40;theProp.indexOf&#40;"style."&#41;==-1 || obj.style&#41;&#41;&#123;
        if &#40;theValue == true || theValue == false&#41;
          eval&#40;"obj."+theProp+"="+theValue&#41;;
        else eval&#40;"obj."+theProp+"='"+theValue+"'"&#41;;
      &#125;
    &#125;
    //-->
    </script>
    </head>
    <body>
    <div id="Layer1" style=" background-color&#58;#66FFFF; position&#58;absolute; width&#58;200px; height&#58;115px; z-index&#58;1; visibility&#58; hidden; left&#58; 318px; top&#58; 142px;">
    	<div align="center">Esempio di prova creato da Claudioweb</div>
    </div>
    <span onMouseOver="MM_changeProp&#40;'Layer1','','style.visibility','visible','LAYER'&#41;" onMouseOut="MM_changeProp&#40;'Layer1','','style.visibility','hidden','LAYER'&#41;">Vieni qui col mouse</span>
    </body>
    </html>
    
    

    Se cerchi su google trovi molti esempi simili.
    Ciao :ciauz: