1

我想使用 asp.net 和 jquery 创建水印。我有一个带有这样的文本框的页面:

<tr>
        <td>
            <%=GetLocaleResourceString("Address.FirstName")%>:
        </td>
        <td>
            <nopCommerce:SimpleTextBox runat="server" ID="txtFirstName" Width="165px" class="watermark" Text="Type your First Name" 
    Tooltip="Type your First Name" ErrorMessage="<% $NopResources:Address.FirstNameIsRequired %>">
            </nopCommerce:SimpleTextBox>
            <asp:Label ID="lblShippingAddressId" runat="server" Visible="false"></asp:Label>
        </td>
    </tr>
    <tr>
        <td>
            <%=GetLocaleResourceString("Address.LastName")%>:
        </td>
        <td>
            <nopCommerce:SimpleTextBox runat="server" ID="txtLastName" Width="165px" ErrorMessage="<% $NopResources:Address.LastNameIsRequired %>">
            </nopCommerce:SimpleTextBox>
        </td>
    </tr>

其中 nopCommerce:SimpleTextBox 是这样的用户控件:

<%@ Control Language="C#" AutoEventWireup="true"
    Inherits="NopSolutions.NopCommerce.Web.Modules.SimpleTextBox" Codebehind="SimpleTextBox.ascx.cs" %>
<asp:TextBox ID="txtValue" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvValue" ControlToValidate="txtValue" Font-Name="verdana"
    Font-Size="9pt" runat="server" Display="Dynamic">*</asp:RequiredFieldValidator>

我正在关注这篇文章:

http://weblogs.asp.net/dotnetstories/archive/2011/11/24/creating-a-simple-watermark-effect-using-jquery.aspx

并在使用文本框控件的页面中添加 css 类和标题(请参阅第一个标记中的标题和 css)。

但是当我看到页面源代码时,我得到了这个标记:

<input type="text" style="width:165px;" class="textBox" id="ctl00_ctl00_cph1_cph1_ctrlCheckoutSinglePage_ctrlCheckoutBillingAddress_ctrlBillingAddress_txtEmail_txtValue" name="ctl00$ctl00$cph1$cph1$ctrlCheckoutSinglePage$ctrlCheckoutBillingAddress$ctrlBillingAddress$txtEmail$txtValue">

没有 CSS 没有添加标题。请建议我如何添加水印?

问候, 阿西夫·哈米德

4

1 回答 1

0

好像没有class="watermark"申请txtValue

<asp:TextBox ID="txtValue" runat="server"></asp:TextBox>

它应该是

<asp:TextBox ID="txtValue" class="watermark" runat="server"></asp:TextBox>
于 2012-07-09T15:00:22.513 回答