PHP ver gevorderde |
|
nvm, niet goed gekeken ;)
ik heb hier trouewns nog een script voor liggen, ff zoeken
function textCounter(maxlimit) {
var field = document.forms[0].elements['smstekst'];
var countfield = document.forms[0].elements['count'];
if (field.value.length > maxlimit) { // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
}
// otherwise, update 'characters left' counter
else {
countfield.value = maxlimit - field.value.length;
}
}
function textCounter(maxlimit) { var field = document.forms[0].elements['smstekst']; var countfield = document.forms[0].elements['count']; if (field.value.length > maxlimit) { // if too long...trim it! field.value = field.value.substring(0, maxlimit); } // otherwise, update 'characters left' counter else { countfield.value = maxlimit - field.value.length; } }
dan maak je je formpje als volgt aan:
<form method="post" action="">
<textarea name="smstekst" cols="4" rows="8" onkeyup="textCounter('160')" onkeydown="textCounter('160')">
<input type="text" name="count" disabled="disabled" value="160">
</form>
<form method="post" action=""> <textarea name="smstekst" cols="4" rows="8" onkeyup="textCounter('160')" onkeydown="textCounter('160')"> <input type="text" name="count" disabled="disabled" value="160"> </form>
|