<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
span{ color:Green; font-weight:bold;}
</style>
<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#txtUserName').focus(function () {
$(this).val('');
})
$('#txtUserName').blur(function () {
if ($(this).val() == 'onlifes') {
$('span').text('用戶名已被註冊,請選擇其他');
}
else {
if ($(this).val() == '') {
$(this).val('用戶名');
$('span').text('請輸入用戶名');
}
else {
$('span').text('可以繼續');
}
}
})
})
</script>
</head>
<body>
用戶名<input id="txtUserName" type="text" value="用戶名" /><span></span>
<br />
密碼<input id="Text1" type="text" value="" />
</body>
</html>