PDA

View Full Version : [SOLVED] javascript works on all but G-chrome -- why?



highspider
April 8th, 2011, 11:30 PM
On Firefox and IExplorer it works perfect; however, Google chrome it limits to 20 chars instead of 800. And I have no Idea why.

RED - Related to code


<html><body>
<script type="text/javascript">
function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // too-long aka copy-paste trim it
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}
</script>

<form name="emailform" id="form_id" method="post" action="cgi-bin/email.pl">

<table>
<tr><td colspan="2"><label for="MSG">
<textarea maxlength='20' rows="20" cols="55" id="MSG" name="MSG"
onKeyDown="textCounter(document.emailform.MSG,document.emailf orm.remLen1,800)"
onKeyUp="textCounter(document.emailform.MSG,document.emailf orm.remLen1,800)">
</textarea>
You have
<input readonly type="text" name="remLen1" size="3" maxlength="3" value="800">
remaining characters. </td></tr>
<tr><td align="center" colspan="2"><input type="submit" value="Submit Message" />
</table></body>
</html>What it does its limit to 800 chars for the message so people don't get diarrhea of mouth filling up email messages.
I'm not the original author I just edited it for my use ~Found on net by: ?~

NOTE: is part of a giant web page but error is still present in the condensed version.

Reiger
April 9th, 2011, 01:35 AM
Well, have you actually looked at your textarea markup? It clearly spells out that the maximum length of the textarea is 20 characters. Try removing it.

highspider
April 9th, 2011, 02:33 AM
Thank You.
maxlength='20'
For some reason I missed that --- Grrr
I thought it was the java and looked past the other code since all 800 chars worked with firefox, seamonkey, and IE. some how the other browser read past that!
THANK YOU