arne2
11-11-2006, 11:09 AM
Hi, i'm having a problem with the form code that i'm trying to script.
The 'max chars' isn't counting down when someone types in something. Can anyone help me with this?
Here is the code I currently have:
<?
$maxchar=1500;
?>
<script language="javascript">
<!--
function mailorderoffers(form)
{ with (form)
{ sisa.value = <?=$maxchar?>-content.value.length;
if (parseInt(sisa.value)<0) { sisa.value = '0'; }
content.value = content.value.substr(0,<?=$maxchar?>);
}
return;
}
//-->
</script>
<form name='mailorderoffers' action='mypage.php' method='POST'>
<font size='4'><b>Contact</b></font>
<br>
<table width='475' border='0' cellpadding='0' cellspacing='0'>
<tr><td width='50%' height='24'>Receiver:</td>
<td width='50%' height='24'><i>
<select name=senndmsgto>
<option name=1 value=1> Technical </option>
<option name=2 value=2> Sales </option>
<option name=3 value=3> General </option>
<option name=4 value=4> Services </option>
<option name=5 value=5> Wholesale </option>
</select>
</i></td></tr>
<tr><td width='50%' height='24'>Subject</td>
<td width='50%' height='24'><input type='text' name='sub'></td></tr>
<tr><td width='50%' height='24'>Name</td>
<td width='50%' height='24'><input type='text' name='name'></td></tr>
<tr><td width='50%' height='24'>Telephone</td>
<td width='50%' height='24'><input type='text' name='tel'></td></tr>
<tr><td width='50%' height='24'>Message</td>
<td><?echo"<textarea max='$maxchar' name='content' COLS='40' ROWS='6' onKeyup='mailorderoffers(document.mailorderoffers);' RAP></textarea>";?>
<br>Max <?=$maxchar?> chars.<br><?echo"Chars left : <input type=\"text\" size=4 name=sisa maxlength=4 value=\"$maxchar\">";?></td></tr>
<br>
<tr>
<td width='50%' height='24'></td>
<td width='50%' height='24'><input type='submit' value='Send'></td>
</tr></form>
The 'max chars' isn't counting down when someone types in something. Can anyone help me with this?
Here is the code I currently have:
<?
$maxchar=1500;
?>
<script language="javascript">
<!--
function mailorderoffers(form)
{ with (form)
{ sisa.value = <?=$maxchar?>-content.value.length;
if (parseInt(sisa.value)<0) { sisa.value = '0'; }
content.value = content.value.substr(0,<?=$maxchar?>);
}
return;
}
//-->
</script>
<form name='mailorderoffers' action='mypage.php' method='POST'>
<font size='4'><b>Contact</b></font>
<br>
<table width='475' border='0' cellpadding='0' cellspacing='0'>
<tr><td width='50%' height='24'>Receiver:</td>
<td width='50%' height='24'><i>
<select name=senndmsgto>
<option name=1 value=1> Technical </option>
<option name=2 value=2> Sales </option>
<option name=3 value=3> General </option>
<option name=4 value=4> Services </option>
<option name=5 value=5> Wholesale </option>
</select>
</i></td></tr>
<tr><td width='50%' height='24'>Subject</td>
<td width='50%' height='24'><input type='text' name='sub'></td></tr>
<tr><td width='50%' height='24'>Name</td>
<td width='50%' height='24'><input type='text' name='name'></td></tr>
<tr><td width='50%' height='24'>Telephone</td>
<td width='50%' height='24'><input type='text' name='tel'></td></tr>
<tr><td width='50%' height='24'>Message</td>
<td><?echo"<textarea max='$maxchar' name='content' COLS='40' ROWS='6' onKeyup='mailorderoffers(document.mailorderoffers);' RAP></textarea>";?>
<br>Max <?=$maxchar?> chars.<br><?echo"Chars left : <input type=\"text\" size=4 name=sisa maxlength=4 value=\"$maxchar\">";?></td></tr>
<br>
<tr>
<td width='50%' height='24'></td>
<td width='50%' height='24'><input type='submit' value='Send'></td>
</tr></form>