I should know the content of js

时间:2014-08-07 13:35:00   收藏:0   阅读:250
  1. 阻止事件传播,必须显示,return false;

  2. return exp?confirm():!!alert();

  3. js 定时器,线程,启动,开始,停止。参数传递,使用window;

  4. js扩展:

String.prototype.Trim = String.prototype.trim = function() {

return this.replace(/(^\s*)|(\s*$)/g, "");

};


function StringBuffer() {

this._strings_ = new Array();

}


StringBuffer.prototype.append = function(str) {

this._strings_.push(str);

return this;

};

StringBuffer.prototype.toString = function() {

return this._strings_.join("");

};


Date.prototype.toSimpleString = function() {

return (this.getFullYear() - 2000) + "/" + (this.getMonth() + 1) + "/" + this.getDate() + " " + this.getHours() + ":" + this.getMinutes();

};


I should know the content of js,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!