CMD下
start    http://s.xiaobai.com/Search?q=xiaobai

可以调起浏览器并打开链接,不过要多转一个参数:
start    http://s.xiaobai.com/Search?q=xiaobai&code=gbk //提示code不是有效命令

用^转义就OK
start  http://s.xiaobai.com/Search?q=中文^&code=gbk

//字符首字母转大写
String.prototype.ucfirst = function(){
    var str = this, s='';
  if(!str.match(/^[a-z]/i)) return str;
    s = str.slice(0, 1).toUpperCase();
  s += str.slice(1);
    return s;
}

//字符首字母转小写
String.prototype.lcfirst = function(){
    var str = this, s='';
  if(!str.match(/^[a-z]/i)) return str;
    s = str.slice(0, 1).toUpperCase();
  s += str.slice(1);
    return s;
}

//所有单词首字母转大写
String.prototype.ucwords = function(){
    var s='';
  var arr = this.split(/\s+/);
  for(i in arr){
    s += (!s?'':' ') + arr[i].ucfirst();
  }
  return s;
}

//所有单词首字母转小写
String.prototype.lcwords = function(){
    var s='';
  var arr = this.split(/\s+/);
  for(i in arr){
    s += (!s?'':' ') + arr[i].lcfirst();
  }
  return s;
}


用法:

var str = "hello world";
var uc = str.ucfirst();//Hello world
var lc = uc.lcfirst();//hellw word
var ucw = lc.ucwords(); //Hello World
var lcw = ucw.lcwords()//hello world
在jQuery Learning群里和几个好友讨论关于JAVASCRIPT对象私有属性时,发现貌似JAVASCRIPT的对象没有private或者protected类型,所有的都是public,不过可以通过闭名(别的高级语言称之为空间)来模拟实现。
看代码吧:

(function(){
var foo = window.foo = function(){
    var error = null;
    this.setError = function(err){
       error = err;
    };
    this.getError = function(){
       return error;
    };
};
})();

var f = new foo();
alert(f.error);        //得到undefined
alert(f.getError());   //得到null
f.setError('aaa');     //error 改变为 aaa
alert(f.getError());   //得到aaa

var f2 = new foo();
alert(f2.error);        //得到undefined
alert(f2.getError());   //得到null
f2.setError('bbb');     //error 改变为 bbb
alert(f2.getError());   //得到bbb

建议直接COPY到FIREBUG运行看效果。

万恶的expression

不指定 deeka , Nov 12 17:56 , 技术领域 » JS/CSS , 评论(0) , 引用(0) , 阅读(183) , 本站原创
_height:expression(this.offsetHeight < 600 ? 600 : this.offsetHeight); overflow:auto;

居然能让IE6直接挂掉!

原因是,over-flow是自动延伸,当DIV里的内容超出原定高度,就会自动延伸,直到刚好等于里面内容的高度,expression的作用DIV改变的时候执行JS脚本。

以上两个正好组成了一个无聊的死循环,故IE6挂了!

CSS实现垂直居

不指定 deeka , Nov 11 09:26 , 技术领域 » JS/CSS , 评论(0) , 引用(0) , 阅读(182) , 本站原创
CSS代码:

#test{
width:200px;
height:80px;
position:absolute;
top:50%;
left:50%;
margin:-40px 0 0 -100px;
border:1px solid #ccc;
}


HTML代码:
<div id="test">some strings</div>


不作详细解析了,大家直接看演示吧!
分页: 10/50 第一页 上页 5 6 7 8 9 10 11 12 13 14 下页 最后页 [ 显示模式: 摘要 | 列表 ]