Jump to content

Character count/restriction in IE


dc_jt

Recommended Posts

Ive done the following which works fine in Firefox but doesnt work at all in IE. Anyone know why?

 

Thanks

 

<script language="javascript">
function calculateTextBox(textBoxName, maximum){

	length = document.getElementById(textBoxName).value.length;

	if(length > maximum){
		document.getElementById(textBoxName).value = document.getElementById(textBoxName).value.substring(0, maximum);
	}else{
		remaining = maximum - length;
		document.getElementById('text_limit_'+textBoxName).innerHTML = remaining ;
	}	

}
</script>

			<td><strong>Short Description *</strong></td><td>
				 <textarea class="txtarea400" style="width:100%; height:250;" rows="10" id="description" name="description" onkeyup="calculateTextBox('description', 200);"><?=(isset($_POST['description']))?stripslashes(htmlentities($_POST['description'])):htmlentities($oObj->description)?></textarea>

                  Maximum 200 characters,  <span  id="text_limit_description" >200</span> remaining

			</td>
		</tr>	

 

Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.