views:

205

answers:

1

Hi all,

I don't think I'm the first one in the world who want to re-invent the wheel for the password input in HTML. I keep Googling but still unable to find the solution.

Okay, here is the work I'd done:

h t t p: / / www.symplik.com/password.html (It just a plain html code, nothing really fancy :>)

The "password" is indeed a text input, and I used the onkeyup event to rewrite the input to masking characters.

There're two problems: (1) backspace or delete cannot be detected (2) if I type very fast, some characters cannot be captured promptly.

For problem (1). it is partially solved by checking the length of text in the password field and the stored password. Not a very elegant solution anyway.

For problem (2), I'd tried to insert some time delay function in between but still fail. I'd make the field readOnly after every keyUp but it still behaves the same.

Any good suggestions?

+6  A: 

Why not use

<input type='password'>

It masks the input for you. No need for javascript.

Kriem