<html>
<head>
<script type="text/javascript" src="jquery-1.7.2.js"></script>
<script type="text/javascript">
$(function(){
$("#username").focus(function(){
var value = $(this).val()
if(value == this.defaultValue)
{
$(this).val("");
}
});
$("#username").blur(function(){
var value = $(this).val();
if(value == '')
{
$(this).val(this.defaultValue);
}
});
$("#password").focus(function(){
var value = $(this).val()
if(value == this.defaultValue)
{
$(this).val("");
}
});
$("#password").blur(function(){
var value = $(this).val();
if(value == '')
{
$(this).val(this.defaultValue);
}
});
});
</script>
</head>
<body>
<input type="text" id="username" value="username"><br>
<input type="password" id="password" value="password"><br>
</body>
</html>
<html>
<head>
<script type="text/javascript" src="jquery-1.7.2.js"></script>
<script type="text/javascript">
$(function(){
$("#username").focus(function(){
var value = $(this).val()
if(value == this.defaultValue)
{
$(this).val("");
}
});
$("#username").blur(function(){
var value = $(this).val();
if(value == '')
{
$(this).val(this.defaultValue);
}
});
$("#password").focus(function(){
var value = $(this).val()
if(value == this.defaultValue)
{
$(this).val("");
}
});
$("#password").blur(function(){
var value = $(this).val();
if(value == '')
{
$(this).val(this.defaultValue);
}
});
});
</script>
</head>
<body>
<input type="text" id="username" value="username"><br>
<input type="password" id="password" value="password"><br>
</body>
</html>
<html>