准备翻译自国外的一篇比较好的,介绍如何结合Asp.net和JQuery进行网页编写的文章。这里先暂时进行记录,随后翻译。后面为jQuery实际操作总结。
编程过程需要随时参考的jQuery网站:http://docs.jquery.com
选择符 | 实例 | 描述 |
Element | $("td") | 选择一个HTML标记 |
#id | $("#divMessage") | 选择一个元素通过它的id |
.cssclass | $(".gridalternate") | 选择一个CSS样式 |
selector,selector | $("input:button,input:text") | 以多个逗号分隔的选择符可以混为一个单一的选择. |
ancestor descendant | $("#divMessage a") | A space between selectors/elements/tags finds nested elements. This syntax is similar to Css ancestor descendant syntax. |
parent > child | $("p > b") | Matches all immediate children of an element or selector expression that match the right element/selector. |
prev ~ siblings | $("#row_11:nth-child(2)~td") | Matches the next siblings at the sample level as the preceeding expression. Example, matches 3-nth columns of a table row. Best used as a find() or filter() against an existing jQuery instance. |
prev + nextsibling + nextsibling | $("#tdMoneyCol+td") | Matches the following sibling. Works best with find() or filter() against an existing jQuery object. |
:filter | $("input:button") | : applies filters to the query. jQuery support CSS 3 filters plus a number of custom filters. Examples: :not,:button,:visible,:hidden,:checked,:first,nth-child(1),:has,:is,:contains,:parent |
[@attribute] | $("p[class=gridalternate] | 选择一个元素的属性: $= 以此为结束符 *= 包含 |
在jQuery中使用asp.net生成的XML文件一定要注意以下问题,看看示例代码部分,其中的加粗部分是必须的,其他的你可以在后台的Asp.net页面中生成,然后Response.Write方法返回: