js获取宽高

var wh = {};
"fo_dlg_3 fo_dlg_4".replace(/[^ ]+/g,function(a){
var elem = document.getElementById(a);
        wh[a] = {};
'Width Height'.replace(/[^ ]+/g, function(i){
wh[a][i] = elem['offset' + i] || elem['client' + i];
});
});
console.log(wh);
posted @ 2011-12-05 10:35  邪恶梦想  阅读(181)  评论(0编辑  收藏  举报