Risultati da 1 a 5 di 5

Discussione: Validazione w3c

  1. #1
    Burrasca forte L'avatar di alb
    Data Registrazione
    03/01/08
    Localitā
    Hamburg - DE
    Etā
    38
    Messaggi
    8,346
    Menzionato
    4 Post(s)

    Predefinito Validazione w3c

    Ho un problema. Sto cercando di validare con le norme xhtml 1.0 strict questo stupidissimo esercizio:

    Codice:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="it" lang="it">
    
    <head>
    <title>Posto barca</title>
    <link type="text/css" rel="Stylesheet" href="(z)esj01.css"/>
    <script type="text/JavaScript">
        function ottieni_prezzo() {
                
        var lung = document.forms[0].lunghezza.value;
        var larg = document.forms[0].larghezza.value;
                
        var sup = lung * larg;
    
            if ((document.forms[0].elements[2].checked) && (document.forms[0].elements[5].checked)) {
                document.forms[0].elements[9].value = sup * 10;
            }
            else if ((document.forms[0].elements[3].checked) && (document.forms[0].elements[5].checked)) {
                document.forms[0].elements[9].value = sup * 10 * 0.7;
            }
            else if (((document.forms[0].elements[4].checked) && (document.forms[0].elements[5].checked)) || ((document.forms[0].elements[2].checked) &&                     (document.forms[0].elements[6].checked))) {
                document.forms[0].elements[9].value = sup * 10 * 0.5;
            }
            else if ((document.forms[0].elements[3].checked) && (document.forms[0].elements[6].checked)) {
                document.forms[0].elements[9].value = sup * 10 * 0.7 * 0.5;
            }
            else if ((document.forms[0].elements[4].checked) && (document.forms[0].elements[6].checked)) {
                document.forms[0].elements[9].value = sup * 10 * 0.5 * 0.5;
            }
    
        }
    </script>
    </head>
    
    <body>
    <h2>Calcolo del prezzo giornaliero</h2>    
    <form action="#" method="post">
    <div id="lg"><p>Lunghezza:</p><input type="text" name="lunghezza" size="10"/></div>
    <div id="wd"><p>Larghezza:</p><input type="text" name="larghezza" size="10"/></div>
    <div id="use"><p>Utilizzo:</p>
    <input type="radio" name="utilizzo" checked="checked"/>diporto
    <input type="radio" name="utilizzo"/>uso professionale
    <input type="radio" name="utilizzo"/>ONLUS</div>
    <div id="type"><p>Tipologia di posto:</p>
    <input type="radio" name="tipo_posto" checked="checked"/>posto in acqua
    <input type="radio" name="tipo_posto"/>posto a terra</div>
    <div id="bottoni"><input type="reset" value="inizializza form"/>
    <input type="button" value="prezzo" onclick="ottieni_prezzo();"/></div>
    <div id="res"><p>Prezzo: </p><input type="text" name="prezzo"/>euro al giorno</div>
    </form>
    </body>
    
    </html>

    Il problema č che mi dā errore sugli ampersand utilizzati per l'and di javascript

    Non so come risolvere il problema, vorrei evitare di mettere lo script su un file esterno.
    Hamburg - Germania
    Occasionalmente a
    Berbenno (BG) - 630 m slm (45°81' N, 9°57' E)

  2. #2
    Vento teso L'avatar di belli83
    Data Registrazione
    25/12/05
    Localitā
    Parma est (54m)
    Etā
    42
    Messaggi
    1,999
    Menzionato
    0 Post(s)

    Predefinito Re: Validazione w3c

    Manda un messaggio a CR.. vista la sua passione per queste cose, ti aiuterā sicuramente
    Ciao Tub!

    Le mie foto su flickr: http://www.flickr.com/photos/belli83/

  3. #3
    Burrasca forte L'avatar di alb
    Data Registrazione
    03/01/08
    Localitā
    Hamburg - DE
    Etā
    38
    Messaggi
    8,346
    Menzionato
    4 Post(s)

    Predefinito Re: Validazione w3c

    Citazione Originariamente Scritto da belli83 Visualizza Messaggio
    manda un messaggio a cr.. Vista la sua passione per queste cose, ti aiuterā sicuramente
    Hamburg - Germania
    Occasionalmente a
    Berbenno (BG) - 630 m slm (45°81' N, 9°57' E)

  4. #4
    Bava di vento L'avatar di kabodie
    Data Registrazione
    07/03/04
    Localitā
    Crema Ovest
    Etā
    42
    Messaggi
    190
    Menzionato
    0 Post(s)

    Predefinito Re: Validazione w3c

    Codice:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="it" lang="it">
    
    <head>
    <title>Posto barca</title>
    <link type="text/css" rel="Stylesheet" href="(z)esj01.css"/>
    <script type="text/JavaScript">
    //<![CDATA[
        function ottieni_prezzo() {
                
        var lung = document.forms[0].lunghezza.value;
        var larg = document.forms[0].larghezza.value;
                
        var sup = lung * larg;
    
            if ((document.forms[0].elements[2].checked) && (document.forms[0].elements[5].checked)) {
                document.forms[0].elements[9].value = sup * 10;
            }
            else if ((document.forms[0].elements[3].checked) && (document.forms[0].elements[5].checked)) {
                document.forms[0].elements[9].value = sup * 10 * 0.7;
            }
            else if (((document.forms[0].elements[4].checked) && (document.forms[0].elements[5].checked)) || ((document.forms[0].elements[2].checked) &&                     (document.forms[0].elements[6].checked))) {
                document.forms[0].elements[9].value = sup * 10 * 0.5;
            }
            else if ((document.forms[0].elements[3].checked) && (document.forms[0].elements[6].checked)) {
                document.forms[0].elements[9].value = sup * 10 * 0.7 * 0.5;
            }
            else if ((document.forms[0].elements[4].checked) && (document.forms[0].elements[6].checked)) {
                document.forms[0].elements[9].value = sup * 10 * 0.5 * 0.5;
            }
    
        }
    //]]>
    </script>
    </head>
    
    <body>
    <h2>Calcolo del prezzo giornaliero</h2>    
    <form action="#" method="post">
    <div id="lg"><p>Lunghezza:</p><input type="text" name="lunghezza" size="10"/></div>
    <div id="wd"><p>Larghezza:</p><input type="text" name="larghezza" size="10"/></div>
    <div id="use"><p>Utilizzo:</p>
    <input type="radio" name="utilizzo" checked="checked"/>diporto
    <input type="radio" name="utilizzo"/>uso professionale
    <input type="radio" name="utilizzo"/>ONLUS</div>
    <div id="type"><p>Tipologia di posto:</p>
    <input type="radio" name="tipo_posto" checked="checked"/>posto in acqua
    <input type="radio" name="tipo_posto"/>posto a terra</div>
    <div id="bottoni"><input type="reset" value="inizializza form"/>
    <input type="button" value="prezzo" onclick="ottieni_prezzo();"/></div>
    <div id="res"><p>Prezzo: </p><input type="text" name="prezzo"/>euro al giorno</div>
    </form>
    </body>
    
    </html>
    http://www.codehouse.com/javascript/tips/xhtml/
    L'unica persona a cui mi sento superiore č me stesso del giorno precedente.

    ~always looking at the sky

  5. #5
    Burrasca forte L'avatar di alb
    Data Registrazione
    03/01/08
    Localitā
    Hamburg - DE
    Etā
    38
    Messaggi
    8,346
    Menzionato
    4 Post(s)

    Predefinito Re: Validazione w3c

    Citazione Originariamente Scritto da kabodie Visualizza Messaggio
    Codice:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="it" lang="it">
    
    <head>
    <title>Posto barca</title>
    <link type="text/css" rel="Stylesheet" href="(z)esj01.css"/>
    <script type="text/JavaScript">
    //<![CDATA[
        function ottieni_prezzo() {
                
        var lung = document.forms[0].lunghezza.value;
        var larg = document.forms[0].larghezza.value;
                
        var sup = lung * larg;
    
            if ((document.forms[0].elements[2].checked) && (document.forms[0].elements[5].checked)) {
                document.forms[0].elements[9].value = sup * 10;
            }
            else if ((document.forms[0].elements[3].checked) && (document.forms[0].elements[5].checked)) {
                document.forms[0].elements[9].value = sup * 10 * 0.7;
            }
            else if (((document.forms[0].elements[4].checked) && (document.forms[0].elements[5].checked)) || ((document.forms[0].elements[2].checked) &&                     (document.forms[0].elements[6].checked))) {
                document.forms[0].elements[9].value = sup * 10 * 0.5;
            }
            else if ((document.forms[0].elements[3].checked) && (document.forms[0].elements[6].checked)) {
                document.forms[0].elements[9].value = sup * 10 * 0.7 * 0.5;
            }
            else if ((document.forms[0].elements[4].checked) && (document.forms[0].elements[6].checked)) {
                document.forms[0].elements[9].value = sup * 10 * 0.5 * 0.5;
            }
    
        }
    //]]>
    </script>
    </head>
    
    <body>
    <h2>Calcolo del prezzo giornaliero</h2>    
    <form action="#" method="post">
    <div id="lg"><p>Lunghezza:</p><input type="text" name="lunghezza" size="10"/></div>
    <div id="wd"><p>Larghezza:</p><input type="text" name="larghezza" size="10"/></div>
    <div id="use"><p>Utilizzo:</p>
    <input type="radio" name="utilizzo" checked="checked"/>diporto
    <input type="radio" name="utilizzo"/>uso professionale
    <input type="radio" name="utilizzo"/>ONLUS</div>
    <div id="type"><p>Tipologia di posto:</p>
    <input type="radio" name="tipo_posto" checked="checked"/>posto in acqua
    <input type="radio" name="tipo_posto"/>posto a terra</div>
    <div id="bottoni"><input type="reset" value="inizializza form"/>
    <input type="button" value="prezzo" onclick="ottieni_prezzo();"/></div>
    <div id="res"><p>Prezzo: </p><input type="text" name="prezzo"/>euro al giorno</div>
    </form>
    </body>
    
    </html>
    http://www.codehouse.com/javascript/tips/xhtml/

    Grazie! Sei stato utilissimo

    Ora č tutto a norma
    Hamburg - Germania
    Occasionalmente a
    Berbenno (BG) - 630 m slm (45°81' N, 9°57' E)

Segnalibri

Permessi di Scrittura

  • Tu non puoi inviare nuove discussioni
  • Tu non puoi inviare risposte
  • Tu non puoi inviare allegati
  • Tu non puoi modificare i tuoi messaggi
  •