15,911,848 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
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