Skocz do zawartości


homilian

Rejestracja: 30 wrz 2011
OFFLINE Ostatnio: 30 09 2011 07:06
-----

Moje tematy

[JS] Wpisywanie w input poprzez button

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.