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なし、タイトルなし。透かしを追加する方法を教えてください。

よろしく、Asif Hameed

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 に答える