Why would Internet explorer not allow changing the type of an input?
I have written a modern login form where 'Username' is written 开发者_如何学Pythonin one field, but is grey, when you click it, it vanishes and also turns the text black, I also have a 'Password' on that starts as a text input, but when you click on it, it is supposed to change to a password type, but it remains text. This seams to only appear on IE8? why and is there a work around?
onFocus='if (this.value == "Password"){ this.value = ""; this.type = "password";}'
Internet Explorer's DOM implementation wasn't designed to handle dynamically changing INPUT types. See http://msdn.microsoft.com/en-us/library/ms534700.aspx.
As a workaround, you can have a hidden password field and then switch visibility between the text box and the password field.
精彩评论