JS文本框默认值处理详解

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

JS文本框默认值处理详解

  2020-05-13 我要评论

复制代码 代码如下:

<script type="text/javascript">
       function txtFocus(el) {
           if (el.defaultValue == el.value) { el.value = ''; el.style.color = '#000'; }
       }

       function txtBlur(el) {
           if (el.value == '') { el.value = el.defaultValue; el.style.color = '#666'; }
       }
    </script>

<asp:TextBox ID="txtBookPerson" runat="server" CssClass="text2" style="color:#666;" onfocus="txtFocus(this)" onblur="txtBlur(this)" value='请输入预定人' ></asp:TextBox>

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们