Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    Problema cancellare scritta

    Questo è il mio sorgente
    codice:
    <!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">
    <head>
    
    
    
    <style type="text/css">
    
    #cella1:hover {
    background-color: white;
    margin: 5 px;
    }
    #cella2:hover {
    background-color: white;
    margin: 5 px;
    }
    #cella3:hover {
    background-color: white;
    margin: 5 px;
    }
    #cella4:hover {
    background-color: white;
    margin: 5 px;
    }
    #cella5:hover {
    background-color: white;
    margin: 5 px;
    }
    #cella6:hover {
    background-color: white;
    margin: 5 px;
    }
    #cella7:hover {
    background-color: white;
    margin: 5 px;
    }
    #cella8:hover {
    background-color: white;
    margin: 5 px;
    }
    </style>
    
    
    <script type="text/javascript">
    
    function cambia1(){
    document.getElementById("cella1").innerHTML="Rillo 1";
    }
    
    function cambia2(){
    document.getElementById("cella2").innerHTML="Rillo 2";
    }
    
    function cambia3(){
    document.getElementById("cella3").innerHTML="Rillo 3";
    }
    
    function cambia4(){
    document.getElementById("cella4").innerHTML="Rillo 4";
    }
    
    function cambia5(){
    document.getElementById("cella5").innerHTML="Rillo 5";
    }
    
    function cambia6(){
    document.getElementById("cella6").innerHTML="Rillo 6";
    }
    
    function cambia7(){
    document.getElementById("cella7").innerHTML="Rillo 7";
    }
    
    function cambia8(){
    document.getElementById("cella8").innerHTML="Rillo 8";
    }
    
    
    </script>
    
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Documento senza titolo</title>
    </head>
    
    
    
    
    
    
    
    <body bgcolor="#0033FF">
    
    
    <center>
    <table  height="500" border="2" bordercolor="white" width="800" bgcolor="#FFFFFF" >   
    <tr>
      <td valign="top">
    
    
    <center>
    <font color="#0033FF" face="book antiqua" size="+4">SAITEC</font></center>
    <center><font color="#0033FF" face="book antique" size="+2 "> di Salvatore Di Raimondo  
    
    
     </font>
    </center>
    
    
    
    <table border="2" bordercolor="white" width="800" height="300" background="lago_diga.png" cellspacing="0">
    <tr>
    <TD width="200" id="cella1" onmouseover=cambia1(); > </TD>  
    <TD width="200" id="cella2" onmouseover=cambia2();></TD>  
    <TD width="200" id="cella3" onmouseover=cambia3();></TD>  
    <TD width="200" id="cella4" onmouseover=cambia4();></TD>  
    </tr>
    <tr>
    <TD width="200" id="cella5" onmouseover=cambia5();></TD>
    <TD width="200" id="cella6" onmouseover=cambia6();></TD>  
    <TD width="200" id="cella7" onmouseover=cambia7();></TD>  
    <TD  width="200" id="cella8" onmouseover=cambia8();></TD>  
    </tr>
    </table>
     <font face="book antiqua" size="+2" color="#0033FF"> Benvenuti nel sito ufficiale</font>
     &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp  &nbsp &nbsp &nbsp &nbsp &nbsp [img]entra (1).gif[/img]
    </td>
    </tr>
    
    </table>
    </center>
    
    
    </body>
    </html>

    Ho inserito una tabella ed ho messo uno sfondo per creare l'effetto puzzle con le celle.
    Il problema è che quando il mouse passa sopra la cella, quest'ultima deve diventare bianca e comparire una scritta. Questo sono riuscito a farlo, il problema è tornare indietro.
    Cioè quando il mouse se ne va dalla cella deve andarsene la scritta e tornare la vecchia immagina....come posso farlo?

  2. #2
    Utente di HTML.it
    Registrato dal
    Oct 2009
    Messaggi
    636
    devi gestire onmouseout.

    <TD width="200" id="cella1" onmouseover=cambia1(); onmouseout=reset1();> </TD>


    Altro consiglio l'unico beneficio delle funzioni sta nel fatto che parametrizzandole non devi scrivere lo stesso codice tante volte.

  3. #3
    si ma all'evento onmouseout cosa devo modificare ?

  4. #4
    Utente di HTML.it
    Registrato dal
    Oct 2009
    Messaggi
    636
    sempre l'attributo innerHTML, se come nell'esempio non c'è scritto nulla imposti .innerHTML=""

    Se i contenuti ci sono potresti salvarli da qualche parte e poi ripristinarli, oppure giocare con .style per fare scomparire e riapparire il testo

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.