Can either of the two pieces of code below be converted to work in PHP only or will they only work in Javascript?
The first one counts and restricts the number of characters inputted into a textarea and the second one highlights the contents of a text area.
Second:
The first one counts and restricts the number of characters inputted into a textarea and the second one highlights the contents of a text area.
Code:
<textarea name="theDescription" wrap=physical cols=75 rows=3
onKeyUp="textCounter(this.form.theDescription,this.form.remLen3,200);"
onKeyDown="textCounter(this.form.theDescription,this.form.remLen3,200);"
onFocus="textCounter(this.form.theDescription,this.form.remLen3,200);"
></textarea>
<br><input readonly type=text name=remLen3 size=4 maxlength=4 value="200"> description characters left.<Br><Br>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function textCounter(field, countfield, maxlimit) {
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;
}
// End -->
</script>
Second:
Code:
<input type=button value="HIGHLIGHT ALL" onClick="javascript:this.form.output1.focus();this.form.output1.select();" class="input1">
<textarea cols=50 rows=15 wrap="hard" name="output1">
BLAH
</textarea>