howdy,

i'm pretty hopeless with javascript.

I have this javascript:
Code:
// countdown for text field
function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}
and this form:
Code:
<form id="sell_item" name="sell_item" method="post" action="?submit">

<input name="title" type="text" id="title" 
onkeydown="textCounter(document.sell_item.title,document.sell_item.Length,60)" 
onkeyup="textCounter(document.sell_item.title,document.sell_item.Length,60)" 
<?php form($title); ?> size="60" maxlength="60" />
<input name="Length" type="text" value="<?php echo 60-strlen($title); ?>" size="2" readonly="readonly" />
</form>
now this works, but the problem is, it requires the name attribute on the form to work. I'm a compliance nut and name is not a valid xhtml attribute. So I know I need to modify the code to getelementbyid, but I can't seem to get it to work...