Vincent van Beveren said the following on 7/13/2006 3:02 PM:
>>onfocus = "this.setAttribute('type', 'password')"
might work.
And then again, it won't. It would have taken less time to test it
than post it though.
I tried that, makes no difference.
That is why I said "it won't" instead of "It might not".
I guess I'll go for the hide/show thing,
though it'll take some additional work to get the focus going
right.
focus "going right" would be simple. onfocus="that.focus()" where "that"
is a reference to the field you unhide and you onfocus the one you are
going to hide.
I also thought about dynamically replacing the whole component
with DOM.
That may or may not be the best way as it may change the tab order of
the input fields. If you try that route, set the tabIndex as well as
creating the element to retain tab navigability.
That should make the focus work more intuitively...
I kinda hoped there would be a very easy solution...
The "easiest" solution is to use a password field to start with. How
would non-JS users get a password field?
Make it a password field, onload remove it and recreate it as a text
input with the value set, then onfocus remove that input and put the
password field back. Very messy situation.
--
Randy
comp.lang.javascript FAQ -
http://jibbering.com/faq & newsgroup weekly
Temporarily at:
http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/