i have the following code form counting the remaining words from a textarea which i took from the internet, but it does not work although i have adapted it to my page.
i took it from this link :
http://www.shiningstar.net/articles/articl...areacounter.asp.
Do you have any idea of what is wrong?
this is the java script:
CODE
<script type="text/javascript">
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;
}
</script>
this is the html:
CODE
<div id="apDiv37">File archive:</div>
<form id="form3" name="form3" enctype="multipart/form-data" method="post" action="upload.php">
<div id="apDiv36">
<input name="file" type="file" id="file" size="62" />
</div>
<div id="apDiv38">File picture:</div>
<div id="apDiv39">
<input name="file_picture" type="file" id="file_picture" size="62" />
</div>
<div id="apDiv40">
<input type="submit" name="submit_upload" id="submit_upload" value="Submit" />
</div>
<div id="apDiv41">
<textarea name="descriere" id="descriere" cols="47" wrap="physical" rows="10"
onKeyDown="textCounter(document.form3.descriere,document.form3.rem_char,300)"
onKeyUp="textCounter(document.form3.descriere,document.form3.rem_char,300)"></textarea>
</div>
</form>
<div id="apDiv46">
<input readonly name="rem_char" type="text" id="rem_char" value="125" size="3" maxlength="3" />
</div>
BTW, on the internet it was language="javascript" not type="text/javascript". Is this an old script or what?
This post has been edited by livium: 27 Jun, 2009 - 11:07 AM