##### [source : https://jsfiddle.net/softm/5fdqa0ho/](https://jsfiddle.net/softm/5fdqa0ho/)
##### # init
```javascript
function init() {
var obj = document.all['test'];
var w = parseFloat(obj.style.width);
var h = parseFloat(obj.style.height);
//alert (w + ' / ' + h );
//alert ( document.body.scrollTop );
var aw = parseFloat(document.body.clientWidth);
var ah = parseFloat(document.body.clientHeight);
//alert (aw + ' / ' + ah );
var t = (ah - h) / 2;
var l = (aw - w) / 2;
//alert (t + ' / ' + l);
obj.style.top = t + parseFloat(document.body.scrollTop);
obj.style.left = l + parseFloat(document.body.scrollLeft);
//alert (obj.style.top + ' / ' + obj.style.left);
}
window.attachEvent('onload',init);
window.attachEvent('onresize',init);
```
##### # html
```html
```
댓글