in my login form ,i have two textbox one for username and the second one for password . both are watermark. the username watermark textbox is having textmode = text
the password textbox is having intially textmode=text but onfocus i want to change it to passwordmode
i dont want to use ajaxcontrols
i am using vb.net
i am using the java script function onfocus,onblur
.help me to convert the textmode of password textbox to password onfocus

When you set the TextMode to 'Password', actually the textbox is rendered as below

<input type="password" name="TextBox1">

If you set TextMode to 'SingleLine, the textbox is rendered as below

<input type="Text" name="TextBox1">

Both HTML INPUT controls are different.

Also the type property in the INPUT control is read only and cannot be changed using JavaScript.

But You can use two different TextBoxes, one for Text mode and another one for Password mode. And show and hide them using JavaScript.


See some sample code in the following link.

Changing an INPUT textbox's TYPE property on the fly

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.