• 16-10-2009, 15:12:43
    #19
    Kimlik doğrulama veya yönetimden onay bekliyor.
    fonksiyon içinde veri girmeden inputtaki değeri kontrol edin. değeri aşıyorsa işlem yaptırmazsınız.
  • 16-10-2009, 15:28:31
    #20
    Üyeliği durduruldu
    fonksiyonu şu şekilde değiştirirseniz düzelir;
    <script language="javascript"> 
    var nereye = 'sifre'; 
    function tusGir(tus){ 
       if(document.getElementById(nereye).value.length<=4) {
             document.getElementById(nereye).value = document.getElementById(nereye).value +  
    tus ; 
        }
    } 
    </script>
  • 16-10-2009, 15:47:18
    #21
    <script language="javascript">
    function tusGir(tus){
        if (document.getElementById(nereye).value.length >= document.getElementById(nereye).getAttribute('maxlength'))
        {
            alert("En fazla "+ document.getElementById(nereye).getAttribute('maxlength') + " karakter girebilirsiniz.");
        }
        else
        {
            document.getElementById(nereye).value = document.getElementById(nereye).value + tus;
        }
    }
    </script></head>
    <body>
    <form action="" method="post" class="" name="numPad">
    <table cellpadding="2" cellspacing="2" border="0" width="44">
    <tr>
         <td colspan="3" align="center">
            <p align="right">Şifreniz
              <input id="quantity" type="text" name="quantity" size="10" maxlength="3" onfocus="nereye='quantity';"></td>
    </tr>
    <tr>
         <td colspan="3" align="center">
            <p align="right">Şifre2
              <input id="quantity1" type="text" name="quantity1" size="10" maxlength="3" onfocus="nereye='quantity1';"></td>
    </tr>
    <tr>
         <td><input type="button" value="  1  " onclick = "tusGir('1');"></td>
         <td><input type="Button" value="  2  "  onclick = "tusGir('2');"></td>
         <td><input type="Button" value="  3  "  onclick = "tusGir('3');"></td>
    </tr>
    <tr>
         <td><input type="Button" value="  4  "  onclick = "tusGir('4');"></td>
         <td><input type="Button" value="  5  "  onclick = "tusGir('5');"></td>
         <td><input type="Button" value="  6  "  onclick = "tusGir('6');"></td>
    </tr>
    <tr>
         <td><input type="Button" value="  7  "  onclick = "tusGir('7');"></td>
         <td><input type="Button" value="  8  "  onclick = "tusGir('8');"></td>
         <td><input type="Button" value="  9  "  onclick = "tusGir('9');"></td>
    </tr>
    <tr>
         <td colspan="3">
            <p align="center">
            <input type="button" value="       0         "  onclick = "tusGir('0');"></td>
    </tr>
    </table>
    </form>
    sanırım böyle daha sağlıklı olur.

    inputlara bir id ve maxlength değeri vermeniz gerekiyor.

    <input id="hede" type="text" name="abc" maxlength="10" onfocus="nereye='hede';" />

    gibi.

    gibi.
  • 16-10-2009, 15:53:28
    #22
    Evet bu kod iyi oldu peki şunu nasıl yapabilirim. Kutucukların degerleri birbirinden farklı olursa,
    input1 alanı mesela şifre : 3 karekter sınırı olacak
    input2 alanı telefon no: 7 karekter sınırı olacak

    <script language="javascript">
    var nereye='quantity';
    function tusGir(tus){
        if (document.getElementById(nereye).value.length >= document.getElementById(nereye).getAttribute('maxlength'))
        {
            alert("En fazla "+ document.getElementById(nereye).getAttribute('maxlength') + " karakter girebilirsiniz.");
        }
        else
        {
            document.getElementById(nereye).value = document.getElementById(nereye).value + tus;
        }
    }
    </script></head>
    <body>
    <form action="" method="post" class="" name="numPad">
    <table cellpadding="2" cellspacing="2" border="0" width="44">
    <tr>
         <td colspan="3" align="center">
            <p align="right">Şifreniz
              <input id="quantity" type="text" name="quantity" size="10" maxlength="5" onfocus="nereye='quantity';"></td>
    </tr>
    <tr>
         <td colspan="3" align="center">
            <p align="right">cep no
              <input id="quantity1" type="text" name="quantity1" size="10" maxlength="7" onfocus="nereye='quantity1';"></td>
    </tr>
    <tr>
         <td><input type="button" value="  1  " onclick = "tusGir('1');"></td>
         <td><input type="Button" value="  2  "  onclick = "tusGir('2');"></td>
         <td><input type="Button" value="  3  "  onclick = "tusGir('3');"></td>
    </tr>
    <tr>
         <td><input type="Button" value="  4  "  onclick = "tusGir('4');"></td>
         <td><input type="Button" value="  5  "  onclick = "tusGir('5');"></td>
         <td><input type="Button" value="  6  "  onclick = "tusGir('6');"></td>
    </tr>
    <tr>
         <td><input type="Button" value="  7  "  onclick = "tusGir('7');"></td>
         <td><input type="Button" value="  8  "  onclick = "tusGir('8');"></td>
         <td><input type="Button" value="  9  "  onclick = "tusGir('9');"></td>
    </tr>
    <tr>
         <td colspan="3">
            <p align="center">
            <input type="button" value="       0         "  onclick = "tusGir('0');"></td>
    </tr>
    </table>
    </form>
  • 16-10-2009, 16:03:17
    #23
    farketmez
    <input id="telefon" name="telefon" type="text" maxlength="7" onfocus="nereye='telefon';" />
    demeniz yeterli olur.

    dipnot:
    var nereye='quantity'; kısmını kaldırın fonksiyondan.
  • 16-10-2009, 21:51:48
    #24
    banka gibi yüksek güvenlik gerektiren birşey yapıyorsanız flash kullanabilirsiniz.