JavaScript 在各个浏览器中执行的耐性,最长执行时间与超时
[ 2013-09-16 08:51:59 | 作者: admin ]
经常会遇到这样一个情况:浏览器弹出对话框,提示脚本运行时间过长,询问“停止”还是“继续”。那究竟各个浏览器是如何判断在什么时候才弹出此对话框呢?
IE:执行超过500W条JScript引擎语句出现提示。
Firefox:执行超过10秒出现提示。
Safari:执行超过5秒出现提示。
Opera:无论执行多久都不会出现提示,最有耐性。
Chrome:执行超过约8秒(估计值)出现提示。
注:当弹出类似alert的模式对话框的时候,是不计时。
更多关于firefox参数列表可以参考:http://blog.xg98.com/article.asp?id=2137
在Web开发的时候,经常会遇到的一种情况就是浏览器提示脚本运行时间过长,停止还是继续,无论你选择什么,相信你都会想尽一切办法让这个对话框远离你的用户们。可你是否知道,这些不同的浏览器究竟是如何判断,哪些脚本处于“失控”状态么?本文作者,就从Internet ...
阅读全文…
IE:执行超过500W条JScript引擎语句出现提示。
Firefox:执行超过10秒出现提示。
Safari:执行超过5秒出现提示。
Opera:无论执行多久都不会出现提示,最有耐性。
Chrome:执行超过约8秒(估计值)出现提示。
注:当弹出类似alert的模式对话框的时候,是不计时。
更多关于firefox参数列表可以参考:http://blog.xg98.com/article.asp?id=2137
在Web开发的时候,经常会遇到的一种情况就是浏览器提示脚本运行时间过长,停止还是继续,无论你选择什么,相信你都会想尽一切办法让这个对话框远离你的用户们。可你是否知道,这些不同的浏览器究竟是如何判断,哪些脚本处于“失控”状态么?本文作者,就从Internet ...
阅读全文…
Jquery 最近浏览过的商品的功能实现代码
[ 2013-09-12 16:24:48 | 作者: admin ]
<script type="text/javascript" src="JS/jquery.js"></script>
<script type="text/javascript" src="JS/JCookie.js"></script> //插件
JCookie.js
阅读全文…
<script type="text/javascript" src="JS/JCookie.js"></script> //插件
JCookie.js
/* JCookie.js * /
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires
...jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires
阅读全文…
推荐一款UBBEditor,兼容IE6,7,8,9 Safari, Firefox, Chrome 等浏览器
[ 2013-09-11 08:48:31 | 作者: admin ]
产品特性与优点
1.迷你
UBBEditor 经压缩存储后小于20KB,载入的时间可以忽略不计。
2.兼容
UBBEditor 可以良好的运行在 IE6,7,8,9 Safari, Firefox, Chrome 等浏览器中。
3.安全
UBBEditor 在编辑文本内容的格式后,所产生的是UBB代码,如果在网页中输出显示时,需要通过服务器脚本来解析这些代码,因此它具备的良好的安全可控性。
4.开源
UBBEditor 是一款开放源代码的程序,你可以在任何项目中任意使用而不需要支付任何费用,并且你也可以很方便的修改源代码来达到更符合自己的要求。
javascript下兼容firefox选取textarea文本的代码
[ 2013-09-10 22:03:12 | 作者: admin ]
function getSelectedText(){
var selectedText;
var textField=document.getElementById('inputTextarea');
if(window.getSelection) selectedText=getTextFieldSelection(textField);//getTextFieldSelection(document.getElementById("inputTextArea"));
else selectedText=document.selection.createRange().text;
alert(selectedText);
}
function getTextFieldSelection(e){
阅读全文…
Javascript获取光标位置以及设置光标位置
[ 2013-09-10 21:20:50 | 作者: admin ]
获取光标位置函数
设置光标位置函数
阅读全文…
function getCursortPosition (ctrl) {
var CaretPos = 0; // IE Support
if (document.selection) {
ctrl.focus ();
var Sel = document.selection.createRange ();
Sel.moveStart ('character', -ctrl.value.length);
CaretPos = Sel.text.length;
}
// Firefox support
else if (ctrl.selectionStart || ctrl.selectionStart == '0')
CaretPos = ctrl.selectionStart;
return (CaretPos);
}
var CaretPos = 0; // IE Support
if (document.selection) {
ctrl.focus ();
var Sel = document.selection.createRange ();
Sel.moveStart ('character', -ctrl.value.length);
CaretPos = Sel.text.length;
}
// Firefox support
else if (ctrl.selectionStart || ctrl.selectionStart == '0')
CaretPos = ctrl.selectionStart;
return (CaretPos);
}
设置光标位置函数
function setCaretPosition(ctrl, pos){
...阅读全文…
Nginx 限速和限制请求配置,使用limit模块仿cc
[ 2013-09-10 09:55:56 | 作者: admin ]
p.s.压力测试是很好的检验方法,用webbech或者ab等一些工具模拟并发服务器,若服务器没有限制连接数或带宽,服务器很容易被压跨。
http {
…
limit_conn_zone $binary_remote_addr zone=one:10m;
limit_req_zone $binary_remote_addr zone=perip:5m rate=20r/s;
#如果在1.1.8之后版本还用语法:limit_zone name $variable size,会报警告nginx: [warn] the “limit_zone” directive is deprecated, use the “limit_conn_zone” directive
#这里,设置客户端的IP地址作为键。注意,这里使用的是$binary_remote_a...
阅读全文…
http {
…
limit_conn_zone $binary_remote_addr zone=one:10m;
limit_req_zone $binary_remote_addr zone=perip:5m rate=20r/s;
#如果在1.1.8之后版本还用语法:limit_zone name $variable size,会报警告nginx: [warn] the “limit_zone” directive is deprecated, use the “limit_conn_zone” directive
#这里,设置客户端的IP地址作为键。注意,这里使用的是$binary_remote_a...
阅读全文…
proftpd基本配置+虚拟用户
[ 2013-09-09 17:17:25 | 作者: admin ]
感觉比vsftpd要方便一点,配置起来比较灵活。
先简单的配置一下。
安装什么的比较简单,如下。
安装好以后,从源码包里复制启动脚本。
# cp proftpd-1.3.4a/contrib/dist/rpm/proftpd.init.d /etc/init.d/proftpd
# chmod 755 /etc/init.d/proftpd
然后,需要在proftpd里面修改一下参数。由于我安装的时候不是默认的目录,所以很多涉及到程序路径的地方要改成安装的位置。具体如下。
# chkconfig: 345 85 15
...
阅读全文…
先简单的配置一下。
安装什么的比较简单,如下。
# tar -zxvf proftpd-1.3.4a
# cd proftpd-1.3.4a
# ./configure –prefix=/usr/local/proftpd
# make
# make install
# cd proftpd-1.3.4a
# ./configure –prefix=/usr/local/proftpd
# make
# make install
安装好以后,从源码包里复制启动脚本。
# cp proftpd-1.3.4a/contrib/dist/rpm/proftpd.init.d /etc/init.d/proftpd
# chmod 755 /etc/init.d/proftpd
然后,需要在proftpd里面修改一下参数。由于我安装的时候不是默认的目录,所以很多涉及到程序路径的地方要改成安装的位置。具体如下。
# chkconfig: 345 85 15
...
阅读全文…
expect spawn、linux expect 用法小记
[ 2013-09-09 17:13:35 | 作者: admin ]
使用expect实现自动登录的脚本,网上有很多,可是都没有一个明白的说明,初学者一般都是照抄、收藏。可是为什么要这么写却不知其然。本文用一个最短的例子说明脚本的原理。
脚本代码如下:
1. [#!/usr/bin/expect]
这一行告诉操作系统...
阅读全文…
脚本代码如下:
##############################################
#!/usr/bin/expect
set timeout 30
spawn ssh -l username 192.168.1.1
expect "password:"
send "ispass\r"
interact
##############################################
#!/usr/bin/expect
set timeout 30
spawn ssh -l username 192.168.1.1
expect "password:"
send "ispass\r"
interact
##############################################
1. [#!/usr/bin/expect]
这一行告诉操作系统...
阅读全文…