Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Cross Browser Question


Message #1 by wroxjs@b... on Fri, 26 Jan 2001 18:17:36 -0000
Hi

I've just recently started using javascript and have written the following
function which displays a countdown of how many characters a user has left
when typing in a text area. The text area is called EventDescription and
the textbox which displays the number of characters left is called
txtCounter.

It works fine in IE, but not in NN4.6 any ideas?

Here's the function. Any help appreciated.

function incrementlength(userInput)
{
	StrLen = window.document.frmAddEvent.EventDescription.value.length;
	if (StrLen > 255){
			window.document.frmAddEvent.EventDescription.value 
window.document.frmAddEvent.EventDescription.value.substring(0,255);
			StrLeft = 0;
		}
	else
		{
			StrLeft = 255 - StrLen;
		}
	window.document.frmAddEvent.txtCounter.value = StrLeft;

  Return to Index