Pagina 2 di 2 primaprima 1 2
Visualizzazione dei risultati da 11 a 15 su 15
  1. #11
    Amministratore L'avatar di Vincent.Zeno
    Registrato dal
    May 2003
    residenza
    Emilia-Romagna (tortellini und cappelletti land!)
    Messaggi
    20,657
    e dagli... cos'è "il quadrato"?

  2. #12
    Un quadrato 100x100px che cambi colore premendo un bottone. Quello intendo per "il quadrato"

  3. #13
    Tipo questo ma dovrebbe poter tornare verde
    codice:
    <html><head>
        <title> Div, class, id </title>
        <link rel="stylesheet" href="stylesheets/style.css"/>
    
    
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
    
    
    <style>
    body {
    color: #a280e2;
    font: 1.2em/1.4em 'Myriad Pro', Helvetica, Arial, Sans-serif,;
    text-align: left;
    margin: 0px;
    }
    
    
    
    
    .yellow {
    background: yellow;
    margin: 100 auto;
    padding: 20px; 
    width: 100px;
    height: 100px;
    }
    
    
    .green {
    background: green;
    margin: 100 auto;
    padding: 20px;
    width: 100px;
    height: 100px;
    }
    
    
    #Blue {
    background: #2700ff;
    margin: 100 auto;
    padding: 20px; 
    width: 100px;
    height: 100px; 
    }
    
    
    #Red {
    background: #ff0000;
    margin: 100 auto;
    padding: 20px;
    width: 100px;
    height: 100px;
    }
    </style>
    
    
    <script>
    $( document ).ready(function() {
    console.log( "ready!" );
    $( "#Blue" ).click(function() {
    $('#Blue').css('background-color', 'yellow');
    alert( "Color Changed" );
    });
    $( "#Red" ).click(function() {
    $('#Red').css('background-color', 'green');
    alert( "Color Changed" );
    });
    });
    
    
    </script>
    
    
    
    
    </head>
    <body> 
    
    
        <div id="Blue" class="yellow"></div>
        <div id="Red" class="Green"></div>
    </body>
    </html>

  4. #14
    Amministratore L'avatar di Vincent.Zeno
    Registrato dal
    May 2003
    residenza
    Emilia-Romagna (tortellini und cappelletti land!)
    Messaggi
    20,657
    codice:
    <!DOCTYPE html><html>
    <head>
    
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script>
    $(document).ready(function(){
        $("button").click(function(){
            $("#mioDIV").toggleClass("redBG");
        });
    });
    </script>
    
    
    <style type="text/css">
    #mioDIV { width:100px; height:100px; }
    .greenBG { background:green; }
    .redBG { background:red; }
    /* IMORTANTE! la classe redBG va definita DOPO greenBG */
    </style>
    
    </head>
    
    
    <body>
    
    
    <div id="mioDIV" class="greenBG"></div>
    <button>Toggle class for element</button>
    
    
    </body>
    </html>

  5. #15
    Ok grazie mille, scusa so che sono noioso ma vorrei solo capire... per metterne più di uno come posso fare? Se creo più div e premo uno dei bottoni, attivano tutti il primo...

    EDIT: Sono riuscito da solo grazie mille
    Ultima modifica di Lucafarnese; 17-11-2017 a 23:54

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.