//事件绑定
pt.bindEvent = function( a , b , c ) {
var d = 'on' + b;
if ( a.addEventListener ) {//ff opera
a.addEventListener( b , c , false );
}
else if ( a.attachEvent ) {//ie
a.attachEvent( d , c );
}
else {
a[d] = c;
}
}
//改名
pt.attEvt = pt.bindEvent;
//事件移除
pt.removeEvent = function( a , b , c ) {
var d = 'on' + b;
if ( a.removeEventListener ) {//ff opera
a.removeEventListener( b , c , false );
}
else if ( a.dettachEvent ) {//ie
a.dettachEvent( d , c );
}
else {
a[d] = null;
}
}
pt.setProps = function( obj , props ) {
if ( typeof obj == 'object' ) {
props = typeof props == 'object' ? props : {};
for ( var prop in props ) {
try {
if ( 'style' == prop ) {
for ( var subProp in props[prop] ) {
obj[prop][subProp] = props[prop][subProp];
}
}
else {
obj[prop] = props[prop];
}
}
catch ( e ) {
}
}
}
}