note's People
note's Issues
Flash IE8 Javascript Error
Flash generates a bunch of js code for communication with javascript. This can easily break in old versions of IE.
Here is some of the Flash generated code:
function __flash__addCallback(instance, name) {
instance[name] = function () {
return eval(instance.CallFunction("<invoke name=\""+name+"\" returntype=\"javascript\">" + __flash__argumentsToXML(arguments,0) + "</invoke>"));
}
}
function __flash__removeCallback(instance, name) {
instance[name] = null;
}
If there is an error in these function, due to "instance" being null, this can be fixed by altering the "object" tag to include name and id.
For example, this code has the error:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" height="294" width="440">
<param name="flashvars" value="file=http://www.bp2go.co.nz/attachments/docs/nav-and-intro-tutorial.flv" />
<param name="allowFullScreen" value="true" /><param name="quality" value="high" />
<param name="src" value="http://www.bp2go.co.nz/swf/player.swf" /> <embed height="294" src="http://www.bp2go.co.nz/swf/player.swf" type="application/x-shockwave-flash" width="440" flashvars="file=/attachments/docs/nav-and-intro-tutorial.flv" allowfullscreen="true" />
</object>
This code works properly:
<object id="dummy" name="dummy" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" height="294" width="440">
<param name="flashvars" value="file=http://www.bp2go.co.nz/attachments/docs/nav-and-intro-tutorial.flv" /> <param name="allowFullScreen" value="true" />
<param name="quality" value="high" /> <param name="src" value="http://www.bp2go.co.nz/swf/player.swf" />
<embed height="294" src="http://www.bp2go.co.nz/swf/player.swf" type="application/x-shockwave-flash" width="440" flashvars="file=/attachments/docs/nav-and-intro-tutorial.flv" allowfullscreen="true" />
</object>
touchend事件没有提供坐标信息?
JSON.parse的疑问
var respanse = '\"{\"url\": \"http://www.sohu.com\"}\"';
console.log(JSON.parse(respanse)) // 报错
var respanse = '\"{\\"url\\": \\"http://www.sohu.com\\"}\"';
console.log(JSON.parse(respanse)) // 不保错
toLocaleDateString函数在不同浏览器下返回的值不一样
function formatDateweek(date) {
function pad(n) {return n < 10 ? "0" + n : n;}
return date.getFullYear() + '-' + pad(date.getMonth() + 1) + '-' + pad(date.getDate());
}
swfLoad插件在不同浏览器的差异
返回的值在chrome下,与利用flash上传的字符串不一样,此时要注意使用JSON.parse。
chrome要parse两次,利用flash上传的要parse一次。
js对象深度拷贝
// 对象深度拷贝, 只拷贝属性,非方法
function depCopy(obj) {
var tempObject = {};
for (key in obj) {
if (typeof obj[key] === 'function') continue;
if (obj[key] !== null && typeof obj[key] === 'object') {
tempObject[key] = depCopy(obj[key]);
} else {
tempObject[key] = obj[key];
}
}
return tempObject;
}
使用 SWFUpload 组件上传的两个问题
1.Flash Cookie Bug:
在非IE内核浏览器下Flash会忽略自身浏览器的所有 cookie , 而会发送持久型的 cookie 到浏览器,但是 Session Only 的 cookie 不会被发送, 也就是说使用 Session 进行登录验证的工作会出现问题,需要使用其它方式,附加上会话验证需要的信息(使用POST参数)以重新启动会话。
2.上传文件类型判断:
通过 SWFUpload 上传的文件类型(Content-Type)会变成 application/otcet-stream ,基于此判断文件类型的操作会失败
Object.defineProperty使用的问题
Object.defineProperty(obj, prop, descriptor)
在 descriptor 中不能同时设置访问器 (get 和 set) 和 wriable 或 value,否则会报以下错误:
Invalid property. A property cannot both have accessors and be writable or have a value
javascript不用加号实现加法
var add = function (a, b) {
if (b === 0) return a;
// console.log(a.toString(2));
// console.log(b.toString(2));
var temp = a ^ b;
// console.log(temp.toString(2));
var carry = (a & b) << 1;
// console.log(carry.toString(2));
return add(temp, carry);
}
如何用nodejs获取本机ip
come from edp
var ip = (function() {
var ifaces = require( 'os' ).networkInterfaces();
var defultAddress = '127.0.0.1';
var ip = defultAddress;
function x( details ) {
if (ip === defultAddress && details.family === 'IPv4') {
ip = details.address;
}
}
for ( var dev in ifaces ) {
ifaces[ dev ].forEach( x );
}
return ip;
})();
Ubuntu 安装 .bundle 文件
一、*.bundle 文件比较特殊,只有在给它了执行权限后才能执行安装操作。所以安装的第一步就是给 *.bundle 文件添加执行权限。介绍两种方法:
1、在 *.bundle 文件上右击鼠标,选择最后一项“属性” 选项,在弹出的“属性”窗口中选择“权限”选项卡,在该选项卡中,可以看到有“允许以程序执行文件”的选项,把它选上,如图:
这样,我们就给该 bundle 文件添加执行权限了。
2、另一种方法就是在终端用命令给 bundle 文件添加执行权限。打开终端(快捷键为 Ctrl+Alt+T ),打开终端后,进入 bundle 文件所在目录(便于操作),然后用以下命令给 bundle 文件添加执行权限:
sudo chmod +x .bundle
回车,输入用户密码,这样就给 bundle 文件添加了执行权限了。
【注:其中,sudo 是以管理员权限运行;chmod 是权限设定命令;+ 表示增加权限;x 表示可执行;】
二、添加好执行权限之后就是安装了。在终端内执行以下命令启动安装流程:
sudo ./.bundle
回车,就启动安装流程了。
【注:先进入 bundle 文件所在目录下】
关于 chmod 的的使用可以用终端下的命令:
chmod --help
查看。
本文出自 “遥望见烟火” 博客,请务必保留此出处http://wuyongzhiyi.blog.51cto.com/4461300/1059292
如何将 HTML 代码转换成实体字符
function HTMLEncode ( input )
{
var converter = document.createElement("DIV");
converter.innerText = input;
var output = converter.innerHTML;
converter = null;
return output;
}
function HTMLDecode ( input )
{
var converter = document.createElement("DIV");
converter.innerHTML = input;
var output = converter.innerText;
converter = null;
return output;
}
作者:钢盅郭子
链接:http://www.zhihu.com/question/20023303/answer/13704515
来源:知乎
著作权归作者所有,转载请联系作者获得授权。
在position: absolute情况下,margin:auto无效
An element with position absolute cannot be centered as the margins cannot be calculated and be centered within.
Position relative works because the element has a position relative to its parent which can be used to calculate the margins.
This article gives a good overview of assigning margins to absolutely positioned elements: http://web.archive.org/web/20130117135705/http://www.vision.to/articles/margins-and-absolute-positioning.php
This forum provides a good description of why it does not work: http://www.justskins.com/forums/css-margins-and-absolute-82168.html
VMware® Workstation 12 Pro 序列号
VMware Workstation 12专业版永久序列号(任选其一)
5A02H-AU243-TZJ49-GTC7K-3C61N
VF5XA-FNDDJ-085GZ-4NXZ9-N20E6
UC5MR-8NE16-H81WY-R7QGV-QG2D8
ZG1WH-ATY96-H80QP-X7PEX-Y30V4
AA3E0-0VDE1-0893Z-KGZ59-QGAVF
touch事件的相关疑惑
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test touch</title>
</head>
<body>
<div style="height:500px;width:200px;background:red" id="f">
<div style="height: 200px;width:100px;background:green" id="s"></div>
</div>
</body>
<script type="text/javascript">
var f = document.getElementById('f');
var s = document.getElementById('s');
f.addEventListener('touchmove', function (evt) {
alert(evt.targetTouches.length)
});
</script>
</html>
Q: 用手指touchmove绿色和红色(两根手指同时触发),这时alert并不是2,而是2次显示1.
这是由于targetTouches是指的是目标节点在该事件下的touchlist
nodejs改变控制台字符颜色
linux下载的2个工具
- wget
支持http, https, ftp
- aria2
支持多协议: HTTP / HTTPS,FTP,SFTP,BitTorrent, Metalink, magnet, ed2k等
<input type=“file”>问题
input type=file 选择文件时,点击取消会触发change事件
document.documentElement.innerHTML在head里面重写页面,body的script依然会加载
开发了2个不同平台的页面,如何根据平台类型来切换?
html的id, name, class区分大小写?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.