<script type="text/javascript">
$(function () {
$("input:text").blur(function () {//失去焦点时
if ($(this).val().length > 0)
$(this).css("background", "red");
else
$(this).css("background", "white");
})
})
</script>