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);

你可能感兴趣的:(js)