如果文本框的手册数据包含“0.00”,则如何清空文本框。 [英] How to blank the textbox if its containing Manual data as "0.00"

查看:47
本文介绍了如果文本框的手册数据包含“0.00”,则如何清空文本框。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我正在开发一个webApplication.In我已经拿了一个文本框输入了0.00的文本框。所以如果我会点击它,文本框应该是空白的,如果我将离开文本框

它再次具有与0.00相同的值。



所以想知道这个...如果有人可以帮助我那么请尽快帮助我。





谢谢,

Hi there,

I am working on a webApplication.In that I have taken a textbox in which text property have entered 0.00.So if I''ll click on it the textbox should be blank and if I''ll leave the textbox
it has again the same value as 0.00.

So wanted to know this...if anybody is there can help me then please help me as soon as possible.


Thanks,

推荐答案

如果你正在开发webapplication(我假设它.net),那么你可以使用如下的javascript函数





If you are working on webapplication (I assume its .net), then you can use javascript function as below


<script type="text/javascript">
       function blanktextbox() {
           var textbx = document.getElementById('<%=TextBox1.ClientID%>');
           if (textbx.value == '0.00')
               textbx.value = '';
       }

       function filltextbox() {
           var textbx = document.getElementById('<%=TextBox1.ClientID%>');
           if (textbx.value == '')
               textbx.value = '0.00';
       }
   </script>





在HTML中你的文本框将是





And in HTML your textbox will be

<asp:textbox id="TextBox1" runat="server" onfocus="blanktextbox();" onblur="filltextbox();" xmlns:asp="#unknown"></asp:textbox>





你完成了:)



and you are done :)


你关心文本框水印 [ ^ ]。

有可能方法 - 使用JavaScript / jQuery,有相同的自定义控件。

该链接将帮助您查看各种选项。看看最适合你的需求。



希望有所帮助!
You care looking for textbox watermarking[^].
There are may ways to do it - using JavaScript/jQuery, there are custom controls for the same.
The link will help you check out various options. See what best suits your need.

Hope that helps!


这篇关于如果文本框的手册数据包含“0.00”,则如何清空文本框。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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