In this thread I will show you two good Java Script functions. With both of them you can calculate how many chars you have.

The first one will calculate a specific element.

function calcspec(element)
{
	if (element.innerHTML != "")  // this function must be first!
	{
		return element.innerHTML.length;
	}

	if (element.value.length > 0)
	{
		return element.value.length;
	}
}

 

The second one will calculate all chars between HTML tags. HTML tags are not included.

function calcall(tag)
{
	return document.documentElement.innerHTML.length;
}

or

function calchtml()
{
	return document.getElementsByTagName("html")[0].innerHTML.length;
}

 

You might however replace innerHTML to outerHTML as shown bellow. This will therefore calculate all document. (does not work in Firefox)

function calcall(tag)
{
	return document.documentElement.outerHTML.length;
}
function calchtml()
{
	return document.getElementsByTagName("html")[0].outerHTML.length;
}