Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 13
  1. #1

    inserire solo numeri nel campo di un form

    esiste uno script in grado di far inserire solo numeri nel campo di un form??

    Una volta mi sembra di aver visto una cosa del genere, ma ora non saprei dove trovarlo...
    The gate to tomorrow is not the light of heaven but the darkness in the depth of the earth

  2. #2
    Utente di HTML.it L'avatar di oronze
    Registrato dal
    Jun 2001
    Messaggi
    3,543
    Hai già postato in html!

    No ai layout tabellari!

    Insulto libero: http://forum.html.it/forum/showthread.php?s=&postid=12524872#post12524872

  3. #3
    So ke non è permesso dal regolamento ma mi hanno consigliato di chiedere qui, altrimenti non avrei mai postato due volte lo stesso messaggio in due forum diversi!
    The gate to tomorrow is not the light of heaven but the darkness in the depth of the earth

  4. #4
    Utente di HTML.it L'avatar di oronze
    Registrato dal
    Jun 2001
    Messaggi
    3,543
    k, scusa!

    No ai layout tabellari!

    Insulto libero: http://forum.html.it/forum/showthread.php?s=&postid=12524872#post12524872

  5. #5
    Up
    The gate to tomorrow is not the light of heaven but the darkness in the depth of the earth

  6. #6
    Reale_Augello
    Guest

    Prova...

    ... così:

    codice:
    <script language="JavaScript">
    
    function Controllo(myform) {
     var valore=myform.campo.value;
     if (isNaN(valore)) {
      alert("Inserire solo numeri!");
      return false;
     }
     return true;
    }
    
    </script>
    Da attivare così:

    <form name="myform" onSumbit="return Controllo(this);">

    Ciao !

  7. #7
    Non so ma non funziona...Allora...ho messo lo script nel tag body xkè prima non mi è possibile (devo inserirlo in uno script php...) ecco cosa ho messo nel tag form:

    <FORM name="myform" action="?act=configure" method="POST" onSumbit="return Controllo(this);">
    The gate to tomorrow is not the light of heaven but the darkness in the depth of the earth

  8. #8
    Reale_Augello
    Guest

    Prova...

    ... così (non usando la funzione):

    <FORM name="myform" action="?act=configure" method="POST" onSumbit="return (!(isNaN(this.nomecampo.value)));">

    Fammi sapere !

  9. #9
    Non funziona Ma questo script dovrebbe funzionare quando clicco sul pulsante submit o quando scrivo una lettera?? io vorrei uno script ke in certi campi del form non faccia proprio scrivere lettere o altri simboli ma solo numeri...sono sicuro di averlo visto...mi ricordassi dove...
    The gate to tomorrow is not the light of heaven but the darkness in the depth of the earth

  10. #10
    Reale_Augello
    Guest

    Vuoi...

    ... un controllo in tempo reale ?
    Prova così:

    <input type="text" name="campo" onKeyUp="if (isNaN(this.value.charAt(this.value.length-1))) this.value=this.value.substr(0,this.value.length-1);">

    Fammi sapere !

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.