IIssNan's Notes

Quick notes


  • 首页

  • 归档

  • 标签

  • 搜索

Sleep function in batch

发表于 2012-08-23 | | 阅读次数

通用:

1
ping 127.0.0.1 -n 5 -w 1000
  • -n 1 only attempt to connect once.
  • -w 3000 wait 3 seconds for reply.

Windows Server 2003 / Windows Vista 以上

1
timeout /T 5

Image resize in JavaScript

发表于 2012-08-23 | | 阅读次数

设置图片组的 src 为自定义属性 data-img-src 的值

1
2
3
4
5
6
7
8
9
10
11
12
13
//注意for循环里的闭包
for(var i = 0; i < images.length; i++){
(function(im){
var img = new Image();
img.onload = function(){
im.src = img.src;
self.imgResize(im, img.width, img.height, 75, 75);
img.onload = null;
}
img.onerror = function(){}
img.src = im.getAttribute("data-img-src");
})(images[i]);
}

jQuery 版本:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
images.each(function(){
if( this.src.indexOf('loading.gif') != -1){
var im = new Image();
var img = this;
im.onload = function(){
img.src = im.src;
self.imgResize(img, im.width, im.height, 75, 75);
im.onload = null;
}
im.onerror = function(){
this.style.width = '75px';
this.style.height = '75px';
im.onerror = null;
}
im.src = this.getAttribute('data-img-src');
}
})

常见浏览器扩展的 MIME

发表于 2012-08-04 | | 阅读次数
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<mime-mapping>
<extension>crx</extension>
<mime-type>application/x-chrome-extension</mime-type>
</mime-mapping>
<mime-mapping>
<extension>sext</extension>
<mime-type>application/x-sogou-extension</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xpi</extension>
<mime-type>application/x-xpinstall</mime-type>
</mime-mapping>
<mime-mapping>
<extension>oex</extension>
<mime-type>application/x-opera-extension</mime-type>
</mime-mapping>
<mime-mapping>
<extension>safariextz</extension>
<mime-type>application/octet-stream</mime-type>
</mime-mapping>

访问 iframe 的 window/document 对象

发表于 2012-08-02 | | 阅读次数

iframe 与宿主页面之间的通讯受 同源策略 影响。

访问 window 对象:

1
var iframeWindow = iframe.contentWindow;

访问 document 对象:

1
2
// IE8以上及标准浏览器通过contentDocument引用,IE8之前的IE使用iframe.document
var iframeDocument = iframe.contentDocument || iframe.document;

parseInt(1/0, 19)=18

发表于 2012-07-28 | | 阅读次数
1…262728…37
IIssNan

IIssNan

胡编一通,乱写一气

183 日志
6 分类
111 标签
RSS
GitHub Twitter 豆瓣 知乎
© 2011 - 2017 IIssNan
由 Hexo 强力驱动
主题 - NexT.Pisces
0%