我有我的背景图片的文本框。每当我点击文本框时,bg图像应该消失,只有文本应该可见。当文本被清除时,bg图像应该再次出现。这怎么可能 ?删除键入文本时的文本框的背景图像。怎么样?
<asp:TextBox runat="server" Width="160px" ID="txt_google_search" style="padding: 6px; background: url('http://www.google.com/cse/intl/en/images/google_custom_search_watermark.gif') no-repeat scroll left center rgb(255, 255, 255);" ></asp:TextBox>
我在我的代码隐藏中尝试了下面的代码,但它无法工作。
txt_google_search.Attributes.Add("onclick", "me.style.backgroundImage = none;")
我得到您所提供的功能这个错误,当我通过萤火虫看到:对象{错误= “Mozilla的错误:无效范围变量” } – Anuya
请核实jQuery是包含在您的网页上。 –