Solved

How can we capture ALT255 Character

Posted on 2002-07-09
5
319 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

757 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now