欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

javascript 簡練的幾個函數(shù)

 更新時間:2009年08月29日 00:43:38   作者:  
看CSDN上別人的代碼,感覺比較精煉,拿來主義,需要的朋友可以看下。

復(fù)制代碼 代碼如下:

//日期類
function myDate(time){
var d = new Date(time);
this.y=d.getFullYear();
this.m=d.getMonth();
this.d=d.getDate();
this.h=d.getHours();
this.m=d.getMinutes();
this.s=d.getSeconds();
}
//創(chuàng)建DOM
function createDOM(e,p){
var el=document.createElement(e);
if(!p)
p=document.body;
p.appendChild(el);
return el;
}
//為dom添加事件監(jiān)聽
function addEvent(el,event,fn){
el.addEventListener?el.addEventListener(event,fn,false):el.attachEvent("on"+event,fn);
}

相關(guān)文章

最新評論