点击上明确的价值ASP输入字段 [英] asp input field on click clear value

查看:100
本文介绍了点击上明确的价值ASP输入字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想,这样,当点击它清除的内容,如果有人不输入任何值,单击另一个字段将再次重新添加的默认值来改变我与我的ASP表单字段输入值,如果改变它留下新文本。

I'm wanting to change the value of my inputs with my asp form fields so that when clicked it clears the content and if someone doesn't type any value and clicks another field it will re-add the default value again, if changed it leaves the new text.

如。现场:

 <asp:TextBox ID="NameInfo"  CssClass="NameInfo" Width="300" runat="server" text="Name" />

感谢您事先的任何响应。我在ASP初学者,所以我不知道怎么做这些类型的功能。

Thanks in advance for any responses. I'm a beginner at asp so I'm not sure how to do these types of features.

推荐答案

我相信你需要的功能将使用jQuery和插件做到最好。也许考虑 HTTP://$c$c.google.com/p/jquery-水印从体验效果很好。

I believe the functionality you need would be best achieved using jQuery and a plugin. Perhaps look into http://code.google.com/p/jquery-watermark which from experience works well.

您应该只需要下载库,然后有一些像你的页面的head标签中的以下内容:

You should just need to download that library and then have something like the following within the head tags of your page:

<script type="text/javascript" src="/path/to/jquery.js"></script>
<script type="text/javascript" src="/path/to/watermarkplugin.js"></script>
<script type="text/javascript">
      $(document).ready(function() {
         $("#<%=NameInfo.ClientID").watermark('The text you want to appear');
      });
</script>

这篇关于点击上明确的价值ASP输入字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆