这是我写的和正在使用:
body{
background-color:#DDD;
}
span.placeholder
{
background-color:#FFF;
color:#777;
border-radius: 4px 4px 4px 4px;
margin: 5px 0;
padding: 9px 0 8px 13px;
width: 297px;
}
input
{
border: 1px solid #707A68;
border-radius: 4px 4px 4px 4px;
margin: 5px 0;
padding: 10px;
width: 310px;
background:transparent;
}
$('input').each(function(){
var txt = $(this).attr('placeholder');
var name = $(this).attr('name');
var node = $(""+txt+"").appendTo($(this).parent());
$(this).before(node);
node.css('position','absolute');
node.css('z-index','-1');
node.css('display','block');
$(this).attr('placeholder','');
});
$('input').bind('keyup',function(){
if($(this).val()=="")
$(this).css('background','transparent');
else
$(this).css('background','#FFF');
});