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

    W3C e comando onFocus=clearText(this)

    Ciao a tutti
    Ho un problemino con l'ottimizzazione di un modulo con W3C vi spiego..
    ho creato uno script per form che se si klikka sopra l'area di testo con il maouse il suo valore sparisce ( non so se mi sono spiegato bene )... per farlo ho usato questo script

    codice:
    <script>
    function clearText(thefield){
    if (thefield.defaultValue==thefield.value)
    thefield.value = ""
    } 
    </script>
    e nel inpunt ho messo

    <input name="mail" type="text" class="nero_10px" onFocus=clearText(this) value="Inserisci la tua E-Mail" size="25">

    ora facendo la convalida con il W3C mi dice

    Line 125, column 80: an attribute value must be a literal unless it contains only name characters

    ..." class="nero_10px" onFocus=clearText(this) value="Inserisci il tuo nome" siz

    You have used a character that is not considered a "name character" in an attribute value. Which characters are considered "name characters" varies between the different document types, but a good rule of thumb is that unless the value contains only lower or upper case letters in the range a-z you must put quotation marks around the value. In fact, unless you have extreme file size requirements it is a very very good idea to always put quote marks around your attribute values. It is never wrong to do so, and very often it is absolutely necessary.
    ora... sapete come potrei risolvere? Se magari conoscete altri scirpt che non causino questo errore fatemi sapere
    ciao e grazie
    http://WWW.HOSTINGTALK.IT
    Forum italiano dedicato all'hosting

  2. #2
    Utente di HTML.it L'avatar di Xinod
    Registrato dal
    Sep 2000
    Messaggi
    13,649
    scrivilo cosi'
    onfocus="clearText(this)"
    i doppi apici dovrebbero sistemare l' errore, ciao

  3. #3
    ottimo grazie mille xinod
    http://WWW.HOSTINGTALK.IT
    Forum italiano dedicato all'hosting

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 © 2025 vBulletin Solutions, Inc. All rights reserved.