标签:
<style type="text/css"> .placeholder{ color: #cacaca; } </style>
<script type="text/javascript"> $(function(){ if(!placeholderSupport()){ // 判断浏览器是否支持 placeholder $(‘[placeholder]‘).focus(function() { var input = $(this); if (input.val() == input.attr(‘placeholder‘)) { input.val(‘‘); input.removeClass(‘placeholder‘); } }).blur(function() { var input = $(this); if (input.val() == ‘‘ || input.val() == input.attr(‘placeholder‘)) { input.addClass(‘placeholder‘); input.val(input.attr(‘placeholder‘)); } }).blur(); }; }) function placeholderSupport() { return ‘placeholder‘ in document.createElement(‘input‘); } </script>
<input id="keywords" placeholder="请输入名称、地址、组织机构代码等关键字查询"/>
标签:
原文地址:http://www.cnblogs.com/fxfly/p/5000222.html