Hey. I am trying to input someting to my site which I’ve seen on other forums, like these – which allow you to increase the size of a text area and decrease it. I found a script that does this, and followed what it said to do – but it’s just not working. Can you see what I missed?
I have a ‘count.js’ which I have in my <head> tags, which loads fine as other code from that works ok.
The other annoying thing is because the href is “#” it means everytime it’s clicked it throws it back up to the top of the page so you have to scroll back down, I don’t see that happening on the other sites I saw it on – maybe that’s just because the code isn’t working though.
count.js contains:
[code]
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;
}
function alter_box_height(boxid, pixelvalue)
{
var box = fetch_object(boxid);
var boxheight = parseInt(box.style.height);
var newheight = boxheight + pixelvalue;
if (newheight > 0)
{
box.style.height = newheight + “px”;
}
return false;
}
On our HTML form we have:
[code]
<tr>
<th class=”intro”><label>Query:</label></th>
<td class=”forminput”><textarea name=”COMMENTS” wrap=”virtual” tabindex=”1″ style=”height: 215px;” class=”formwidth” cols=”45″ rows=”13″ onkeydown=”textCounter(this.form.COMMENTS,this.form.remLen1,9000);” onkeyup=”textCounter(this.form.COMMENTS,this.form.remLen1,9000);”></textarea><br />
<input disabled=”disabled” type=”text” name=”remLen1″ size=”4″ maxlength=”4″ value=”9000″ /> characters left | <a href=”#” onclick=”return alter_box_height(‘COMMENTS’, 100)”>Increase size</a> | <a href=”#” onclick=”return alter_box_height(‘COMMENTS’, -100)”>Decrease size</a></td>
</tr>