Solved

How can we capture ALT255 Character

Posted on 2002-07-09
5
325 Views
Last Modified: 2012-06-27
Hi All

When we Type while Pressing ALT, 255, then we get a special character like Space(" "). How can we capture this character with JavaScript.

Thanks
Sanjay Saluja
0
Comment
Question by:ssaluja
  • 3
5 Comments
 
LVL 9

Expert Comment

by:Venci75
ID: 7140713
<input type=text name=txt>
<button onclick="for (i=0; i<txt.value.length; i++) if (txt.value.charAt(i) == ' ') alert('255 found'); else alert('OK');"
0
 
LVL 9

Expert Comment

by:Venci75
ID: 7140715
... txt.value.charAt(i) == ' ' ...
this here is typed by using ALT+255
0
 

Author Comment

by:ssaluja
ID: 7142896
Hi Venci75

I have checked both ways but it is not handling it, since it is not a simple BLANK space ' '. So Please tell me if any other way out is there..


Thanks
Sanjay
0
 
LVL 9

Accepted Solution

by:
Venci75 earned 50 total points
ID: 7142994
ok - you can then try something like this:

<input type=text name=txt>

<button onclick="if (txt.value.indexOf(String.fromCharCode(<code>)) >=0) alert('255 found'); else alert('OK');">

but this won't work in all cases. You must check what is the code of the 255 character in ISO-Latin-1 codeset.

on my computer it is 160 - so this should be:
... String.fromCharCode(160) ...


btw: the previous suggestion will work if you type in ALT+255 where you think it is space
0
 
LVL 35

Expert Comment

by:girionis
ID: 8916805
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- points to Venci75

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question