Javascript 在C#.net中单击时,文本框中的占位符文本应隐藏

Javascript 在C#.net中单击时,文本框中的占位符文本应隐藏,javascript,.net,c#-4.0,Javascript,.net,C# 4.0,我想知道如何使用文本框中的占位符。我想使用一些文本框,它必须说“在这里输入您的名字”。。我想在用户单击文本框时清除文本。如果他没有在文本框中再次输入任何内容,它应该说“在此处输入您的姓名”。您需要使用下面的html <input type="text" placeholder="Receiver name" maxlength="40" id="fname" name="fname" class="ci-heading ci-shadow-inset ui-input-text ui-bo

我想知道如何使用文本框中的占位符。我想使用一些文本框,它必须说“在这里输入您的名字”。。我想在用户单击文本框时清除文本。如果他没有在文本框中再次输入任何内容,它应该说“在此处输入您的姓名”。

您需要使用下面的html

<input type="text" placeholder="Receiver name" maxlength="40" id="fname" name="fname" class="ci-heading ci-shadow-inset ui-input-text ui-body-c ui-corner-all ui-shadow-inset">

在Asp.net中,您可以将其编写为:

<ASP:TextBox id="txt1" placeholder="Receiver name"></ASP:TextBox>

简单html代码:

<html>
<body>  
<form action="#" method="POST">  
    <input type="text" placeholder="Receiver name" maxlength="40" id="fname" name="fname" class="ci-heading ci-shadow-inset ui-input-text ui-body-c ui-corner-all ui-shadow-inset">
        </form>        
    </div>
</body>
</html>