I wanted to use a "self-labelled" input fields to accept username and passwords with javascript as shown below. UX-wise, it seems to be working well. However, since I'm changing the "type" of the password-input field upon focus/blur, I'm concerned if this will pose any kind of risk. It probably should not, but just want to be sure.
<form method="post" action="/login">
<fieldset>
<h3>Login</h3>
<input id="username" name="username" type="text" value="Username" onblur="if (this.value == '') { this.value = 'Username'; }" onfocus="if (this.value == 'Username') { this.value = ''; }"/>
<input id="password" name="password" type="text" value="Password " onblur="if (this.value == '') { this.value = 'Password '; this.type = 'text' }" onfocus="this.type = 'password'; if (this.value == 'Password ') { this.value = ''; }"/>
<input id="submit" name="submit" type="submit" value="Login"/>
</fieldset>
</form>