none
The Password is being keyed, briefly display the last character before masking it as an asterisk (*) a bullet point (•) RRS feed

  • 问题

  • Hi,

    I am doing the mobile Web Application in MVC3 Razor. I am new to the MVC3.In my login page  i have this requirement 

    "The Password is being keyed, briefly display the last character before masking it as an asterisk (*) or a bullet point (•)".

    Please give me the suggestion as soon as poosible.

    Thanks,

    Madhuri Tumati.


    2012年5月3日 6:53

答案

  • You need to tie an event handler in javascript to onkeypress event (not to use onkeyup or keydown because you'll lost characters if user press and holds a key).

    In that you'll:

    1) compare the length of your text field to a hidden field;
    2) copy the final characters (determined by length difference) to the shadow field;
    3) replace the textfield content with the "*" equal to previous length of the hidden field, plus that final characters;
    4) set the selection range to the end of the textbox.

    EDIT: Changed the function logic a bit so it'll even handle case or repetitive keypress or a paste action.


    2012年5月4日 3:14