Click here to Skip to main content
15,911,848 members

Comments by moses12345 (Top 5 by date)

moses12345 2-Apr-12 6:36am View    
function langChk()
{
var str = new String(document.getElementById('txt2').innerText);
var i = 0;
var cnt = str.length;
if(cnt == 0)
{
document.all('msgCounter').innerHTML = "0"
document.all('chrCounter').innerHTML = "0"
}

for(i=0 ; i < cnt ; i++) // will not start unless cnt > 0
{
var ch = parseInt(str.charCodeAt(i));

if(ch >= 1488 && ch <=1514) //chk 4 heb
{
counter(1,cnt);
break;
}
else
counter(2,cnt);
}
}

function counter(method,cnt) //accepts lang method and calc num of msgs
{
switch(method)
{
case 1 :
if(cnt > 0 && cnt <= 70)
setTextContent(document.getElementById('msgCounter'),"1");
if(cnt > 70 && cnt <= 134)
setTextContent(document.getElementById('msgCounter'),"2");
if(cnt > 134 && cnt <= 201)
setTextContent(document.getElementById('msgCounter'),"3");
if(cnt > 201 && cnt <= 268)
setTextContent(document.getElementById('msgCounter'),"4");//tmp - need to determine limitation for msgs
break;
case 2 :
if(cnt > 0 && cnt <= 160)
setTextContent(document.getElementById('msgCounter'),"1");
if(cnt > 160 && cnt <= 306)
setTextContent(document.getElementById('msgCounter'),"2");
if(cnt > 306 && cnt <= 459)
setTextContent(document.getElementById('msgCounter'),"3");
break;
}
//document.getElementById('chrCounter').innerText = cnt;
setTextContent(document.getElementById('chrCounter'),cnt);
}

function setTextContent(element, text)
{
while (element.firstChild!==null)
element.removeChild(element.firstChild); // remove all existing content
element.appendChild(document.createTextNode(text));
}
moses12345 2-Apr-12 6:32am View    
ok guys, i pasted the wrong code, but i actually changed it
still not working . what im trying to do, is on every keyup event calculate the chars in the tectarea and write this counter result in a label.
moses12345 1-Apr-12 2:09am View    
the green button is for a solution, non of the above is a solution, and all was well known before you wrote an essay instead of quick helpful soultion .
please let other ppl here comment about this and do not disturb .

and a quick tip for life : lose your attitude, try to leave a good impression on ppl, never hold your nose up high, coz sometimes you don't know who your'e talking to, and what picture do they get of you .
moses
moses12345 31-Mar-12 17:36pm View    
hi,
well i guess i'm not a REAL web developer like you, but i asked a simple question dude, try to focus next time .
moses12345 28-Mar-12 5:50am View    
thank you guys for your quick reply

but none of the above works.

how can i take the char entered in my textarea and find if its hebrew with \u0590 \u05ff

???

i need that step by step help guys.


moses