新手问个Jquery有关问题。
新手问个Jquery问题。。
我的问题是上面的jquery函数中的this.title表示的是什么????this指的是哪个对象?title又指的是什么???
为什么?
------解决方案--------------------
对不起说错了 this.title 等于ToolTip的值
TEXTBOX生成的HTML如下 取的是 input 和 title 也就是当前控件的title属性
<input name="TextBox1" type="text" id="TextBox1" title="请在这里输入要查询的内容" class="jQueryText" style="width:300px;">
------解决方案--------------------
this 指的就是TextBox1
this.title 就是TextBox1的ToolTip值
------解决方案--------------------
this.title=$(this).attr("title");
- HTML code
<head runat="server"> <title></title> <style type="text/css"> .jQueryText { font-style:italic; color:#CCCCCC; } </style> <script type="text/javascript" src="JQuery/jquery-1.4.2-vsdoc.js"></script> <script type="text/javascript" language="javascript"> $(function() { var searchBox = $('#<%=TextBox1.ClientID%>'); searchBox.blur(function() { if (searchBox.val() == "") { searchBox.val(this.title); } }); searchBox.focus( function() { if (searchBox.val() == this.title) { searchBox.val(""); } }); }); </script> </head> <body> <form runat="server"> <div> <asp:TextBox ID="TextBox1" width="300px" CssClass="jQueryText" ToolTip="请在这里输入要查询的内容" runat="server"></asp:TextBox> <asp:Button ID="btnSubmit" Text="搜索" runat="server" /> </div> </form> </body> </html>
我的问题是上面的jquery函数中的this.title表示的是什么????this指的是哪个对象?title又指的是什么???
为什么?
------解决方案--------------------
对不起说错了 this.title 等于ToolTip的值
TEXTBOX生成的HTML如下 取的是 input 和 title 也就是当前控件的title属性
<input name="TextBox1" type="text" id="TextBox1" title="请在这里输入要查询的内容" class="jQueryText" style="width:300px;">
------解决方案--------------------
this 指的就是TextBox1
this.title 就是TextBox1的ToolTip值
------解决方案--------------------
this.title=$(this).attr("title");