Jump to content

JS problem


sphinx

Recommended Posts

Hello,

 

I'm using this code to display how many characters remain in a text box:

 

<script language = "Javascript">
maxL=500;
var bName = navigator.appName;
function taLimit(taObj) {
if (taObj.value.length==maxL) return false;
return true;
}

function taCount(taObj,Cnt) { 
objCnt=createObject(Cnt);
objVal=taObj.value;
if (objVal.length>maxL) objVal=objVal.substring(0,maxL);
if (objCnt) {
	if(bName == "Netscape"){	
		objCnt.textContent=maxL-objVal.length;}
	else{objCnt.innerText=maxL-objVal.length;}
}
return true;
}
function createObject(objId) {
if (document.getElementById) return document.getElementById(objId);
else if (document.layers) return eval("document." + objId);
else if (document.all) return eval("document.all." + objId);
else return eval("document." + objId);
}
</script>

 

However, when all 500 characters have been filled, it doesn't let you remove any characters, anyone know why?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/247533-js-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.