Skocz do zawartości


Zdjęcie

[JS] Wpisywanie w input poprzez button


  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 homilian

homilian

    Nowy

  • 1 postów

Napisano 30 09 2011 - 00:21

Witam, prosto z mostu:
<input type="button" value="1" onclick="document.getElementById('pin').value+='1'">
<input type="button" value="2" onclick="document.getElementById('pin').value+='2'">
<input type="button" value="3" onclick="document.getElementById('pin').value+='3'">
<br />
<input type="button" value="4" onclick="document.getElementById('pin').value+='4'">
<input type="button" value="5" onclick="document.getElementById('pin').value+='5'">
<input type="button" value="6" onclick="document.getElementById('pin').value+='6'">
<br />
<input type="button" value="7" onclick="document.getElementById('pin').value+='7'">
<input type="button" value="8" onclick="document.getElementById('pin').value+='8'">
<input type="button" value="9" onclick="document.getElementById('pin').value+='9'">
<br />
<input type="button" value="">
<input type="button" value="0" onclick="document.getElementById('pin').value+='0'">
<input type="button" value=""><br />
<input type="text" id="pin" maxlength="4">

Klikając na buttony można dodać więcej niż 4 znaki (ignoruje maxlength) jak temu zaradzić?

Pozdrawiam.

  • 0




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych