随笔分类 -  jquery

学好jquery
javascript代码规范小结
摘要:1. Javascript代码应符合Douban-JSLint检验标准1-1. 语句必须都有分号结尾,除了for, function, if, switch, try, while1-2. 只有长语句可以考虑断行,如:TEMPL_SONGLIST.replace('{TABLE}', da['results']) .replace('{PREV_NUM}', prev) .replace('{NEXT_NUM}', next) .replace('{CURRENT_NUM}', current) .replace( 阅读全文

posted @ 2012-07-13 23:38 爱上某人 阅读(132) 评论(0) 推荐(0)

jQuery 过滤not()与filter()实例代码
摘要:第一种写法: 复制代码 代码如下:$(function(){ $("li").not(":even").css("color","red"); $("li").filter(":odd").css("color","red"); }) 第二种写法: 复制代码 代码如下:$(function(){ $("li").filter(function(index) { return index%2 == 0; }).css( 阅读全文

posted @ 2012-07-13 23:35 爱上某人 阅读(165) 评论(0) 推荐(0)

jquery命令汇总,方便使用jquery的朋友
摘要:选择器 实例 选取* $("*") 所有元素#id $("#lastname") id="lastname" 的元素.class $(".intro") 所有 class="intro" 的元素element $("p") 所有 <p> 元素.class.class $(".intro.demo") 所有 class="intro" 且 class="demo" 的元素:first $("p:f 阅读全文

posted @ 2012-07-13 23:32 爱上某人 阅读(115) 评论(0) 推荐(0)

jquery 实现表单验证功能代码(简洁)
摘要:html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>表单验证页面</title> <link href="../Scripts/themes/default/easyui.css" rel="stylesheet" type="text/css" /> <script src="../Scripts/jquery-1.4.1.min.js" type="text/j 阅读全文

posted @ 2012-07-13 23:31 爱上某人 阅读(250) 评论(0) 推荐(0)

jQuery $.get 的妙用 访问本地文本文件
摘要:场景: 当页面文件.html作为本地文件打开(即IE路径为file:///开头的)的时候,需要访问本地文本文件的内容时。 本地文件目录在页面文件的子文件夹。 目录结构 |-test.html |-Scripts |-data.txt 需要访问data.txt的内容。 代码: 复制代码 代码如下:$.get('Scripts/data.txt').success(function(content){ // content就为文件data.txt的文本内容了,注意txt文件的编码需要与html文件的编码一致,最好保存成utf-8 }); 详细出处参考:http://www.jb51 阅读全文

posted @ 2012-07-13 23:28 爱上某人 阅读(291) 评论(0) 推荐(0)

导航