【备忘】JavaScript–正则表达式实例
正则表达式实例,不但补充中
阅读全文…
原创文章,转载请注明: 转载自DevNotes: Development with Notes
本文链接地址: 【备忘】JavaScript–正则表达式实例
正则表达式实例,不但补充中
阅读全文…
原创文章,转载请注明: 转载自DevNotes: Development with Notes
本文链接地址: 【备忘】JavaScript–正则表达式实例
正则表达式(regular expression)对象包含一个正则表达式模式(pattern)。它具有用正则表达式模式去匹配或代替一个串(string)中特定字符(或字符集合)的属性(properties)和方法(methods)。
原创文章,转载请注明: 转载自DevNotes: Development with Notes
本文链接地址: 【备忘】JavaScript–正则表达式语法
在ie6中对于通过obj.value是可以获取客户端选择文件的全路径的,但是到ie7就只能获取文件名,这对于onchange事件立即显示图片会有问题,可以用js方法解决
阅读全文…
原创文章,转载请注明: 转载自DevNotes: Development with Notes
本文链接地址: js获取上传图片全路径,支持ie,firefox
iframe中刷新父页面
window.parent.location.reload()
调用父窗口中JS函数
self.parent.tb_remove();
选择符
jquery选择符
$(‘div.horizontal:eq(1)’) 从第一个开始算
CSS 选择符
$(‘div:nth-child(1)’) 第一个DIV
XPATH 选择符
$(‘input[@type="text"]‘).addClass(‘input’);
$(‘a[@href^="mailto:"]‘).addClass(‘mailto’);
$(‘a[@href$=".pdf"]‘).addClass(‘pdf’);
$(‘a[@href*="mysite.com"]‘).addClass(‘mysite’);
table tr 交替使用样式表
$(‘tr:odd’).addClass(‘oddclass’); 偶数 0开始的
$(‘tr:even’).addClass(‘evenclass’); 奇数
$(‘tr:not[th]:odd’).addClass(‘odd’);
关键词所在行高亮
$(‘td:contains(“关键词”)’).addClass(‘hight’);
$(‘td:contains(“关键词”)’).next().addClass(‘hight’);
取得同一级别td,除了包含23的所有td加样式表
$(‘td:contains(“23″)’).siblings().addClass(“redred”);
等价(td父级中找td编号大于0的加样式表)
$(‘td:contains(“23″)’).parent().find(‘td:gt(0)’).addClass(‘redred’);
等价
$(‘td:contains(“23″)’).parent().find(‘td’).not(‘:contains(“23″)’).addClass
(‘redred’);
包含23父级,在找到父级的第2个td,取消,再查找第3个td
$(‘td:contains(“23″)’).parent().find(‘td:eq(1)’).addClass(‘redred’).end().find
(‘td:eq(2)’).addClass(‘redred’);
或去ID所在的属性标签如
得到的是 body迭代交替
.toggle() ;toggleClass.()<如果存在(不存在)就删除(添加)一个类>
.hover()
原创文章,转载请注明: 转载自DevNotes: Development with Notes
本文链接地址: 【笔记】 个人 jquery 常用函数
iframe中刷新父页面
window.parent.location.reload()
调用父窗口中JS函数
self.parent.tb_remove();
阅读全文…
原创文章,转载请注明: 转载自DevNotes: Development with Notes
本文链接地址: javascript 中框架间引用及调用
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <script type="text/javascript"> $(".deldata").click(function(){ var id; id = $(this).attr('id'); if(confirm('确定删除吗?')){ $.ajax({ type: "POST", url: "/data/del", data: "id="+id, success: function(msg){ $("#"+id).parent().parent().hide('slow'); } }); } }) </script> |
1 2 3 4 5 6 7 8 | <table> <tr> <td><a class='deldata' id=1 >xxxxx</a></td> </tr> <tr> <td><a class='deldata' id=2 >yyyyy</a></td> </tr> </table> |
原创文章,转载请注明: 转载自DevNotes: Development with Notes
本文链接地址: jquery ajax轻松删除行,即时显示删除渐变
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <script type="text/javascript"> $(document).ready(function(){ $(".update").dblclick(function(){ id = $(this).attr('id'); text = $(this).text(); if(text){ $(this).html("<input type='text' size=12 name="+id+" value="+text+">"); $(".update > input").focus().blur(function(){ $.ajax({ type: "POST", url: "/data/dbedit", data: "id="+id+"&no="+$("#"+id+" >input").val(), success: function(msg){ $("#"+id).text(msg); } }); }) } }) }) </script> |
1 2 3 4 5 | <table> </tr> <td style="text-align:center;" class="update" id="123" >文本内容</td> </tr> </table> |
原创文章,转载请注明: 转载自DevNotes: Development with Notes
本文链接地址: jquery 轻松实现 双击编辑文本框
和大家分享下 jquery 1.3 中文手册
顺带提供下 learing jquery 的中文PDF资料(90.58MB)
http://www.namipan.com/d/Learning_jQuery_zh_CN.pdf/80341676e4c27c2302f1c5fc70e1129b5419162a2f47a905
原创文章,转载请注明: 转载自DevNotes: Development with Notes
本文链接地址: jquery 1.3 中文手册
这几天正在为压缩代码的事情所困扰,大家也可以看见,我的博客顶端有两个在线的压缩工具,但在实际应用过程中,除了CSS的压缩比较满意外,JS的压缩,很是不爽,如果语法有问题的话(比如缺少”;”),就会出现无法预知的错误。
不过让人欣慰的是,Yahoo!给我们带来了YUI compressor!,呵呵,废话少说,赶紧体验。
YUI compressor的下载地址是:http://developer.yahoo.com/yui/compressor/
淘宝做了一个可视化的版本,叫做TBCompressor,可以到这里下载:http://lifesinger.org/blog/?p=464
谢谢岁月老大!
原创文章,转载请注明: 转载自DevNotes: Development with Notes
本文链接地址: YUI compressor 安装及使用,js压缩好工具
今天公司要在页面上方一个左侧JS悬浮广告条,记录下,以后用的上
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | <div id="sorollDiv1" style="width:110px;; left:10px;position:absolute;top:120px;">
<img src="2.jpg" >
</div>
<script type="text/javascript">
//新世界广告条
var lastScrollY=0;
function heartBeat(){
diffY=document.documentElement.scrollTop;
percent=0.1*(diffY-lastScrollY);
if(percent>0)percent=Math.ceil(percent);
else percent=Math.floor(percent);
document.getElementById("sorollDiv1").style.top=parseInt(document.getElementById("sorollDiv1").style.top)+percent+"px";
lastScrollY=lastScrollY+percent;
}
window.setInterval("heartBeat()",1);
</script>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br> |
原创文章,转载请注明: 转载自DevNotes: Development with Notes
本文链接地址: 【笔记】一个js左侧悬浮广告条