hoangsta
11-19-2003, 12:23 PM
hi, i'm trying to do tis script...the weird thing is that it works for my other pages, but for some odd reason, it doesn't for others..
<SCRIPT language="JavaScript">
var limit = 300;
function check() {
if(document.frmInsertbusiness.bus_desc.value.length > limit) {
alert('Sorry, the description is too long');
document.frmInsertbusiness.bus_desc.focus();
return false; }
else
return true; }
function update() {
var old = document.frmInsertbusiness.counter.value;
document.frmInsertbusiness.counter.value=document.frmInsertbusiness.bus_desc.value.length;
if(document.frmInsertbusiness.counter.value > limit && old <= limit) {
alert('Too much data in the text box!');
if(document.styleSheets) {
document.frmInsertbusiness.counter.style.fontWeight = 'bold';
document.frmInsertbusiness.counter.style.color = '#ff0000'; } }
else if(document.frmInsertbusiness.counter.value <= limit && old > limit
&& document.styleSheets ) {
document.frmInsertbusiness.counter.style.fontWeight = 'normal';
document.frmInsertbusiness.counter.style.color = '#000000'; }
}
</script>
This is my <form></form>
<p class="bold">Description about your business (e.g., Services, Business Hours, etc)<br>
<TEXTAREA NAME="bus_desc" rows="10" cols="50" onkeyup="update();">$bus_desc</textarea></p>
<script type="text/javascript" language="JavaScript1.2">
document.write('Characters typed: <input '+
'type="text" size="3" name="counter" value=""'+
'readonly onfocus="this.form.box.focus()"> (limit: '+
limit+')');
</script>
can someone help? thank you in advance
<SCRIPT language="JavaScript">
var limit = 300;
function check() {
if(document.frmInsertbusiness.bus_desc.value.length > limit) {
alert('Sorry, the description is too long');
document.frmInsertbusiness.bus_desc.focus();
return false; }
else
return true; }
function update() {
var old = document.frmInsertbusiness.counter.value;
document.frmInsertbusiness.counter.value=document.frmInsertbusiness.bus_desc.value.length;
if(document.frmInsertbusiness.counter.value > limit && old <= limit) {
alert('Too much data in the text box!');
if(document.styleSheets) {
document.frmInsertbusiness.counter.style.fontWeight = 'bold';
document.frmInsertbusiness.counter.style.color = '#ff0000'; } }
else if(document.frmInsertbusiness.counter.value <= limit && old > limit
&& document.styleSheets ) {
document.frmInsertbusiness.counter.style.fontWeight = 'normal';
document.frmInsertbusiness.counter.style.color = '#000000'; }
}
</script>
This is my <form></form>
<p class="bold">Description about your business (e.g., Services, Business Hours, etc)<br>
<TEXTAREA NAME="bus_desc" rows="10" cols="50" onkeyup="update();">$bus_desc</textarea></p>
<script type="text/javascript" language="JavaScript1.2">
document.write('Characters typed: <input '+
'type="text" size="3" name="counter" value=""'+
'readonly onfocus="this.form.box.focus()"> (limit: '+
limit+')');
</script>
can someone help? thank you in advance