CSSOM视图模式clientLeft/clientTop属性实例页面

回到相关文章 »

代码:

HTML代码:
<button id="button1">点击弹出本按钮的clientLeft和clientTop</button>
                
JS代码:
document.getElementById("button1").onclick = function() {
    alert("clientLeft: " + this.clientLeft + ", \r\nclientTop: " + this.clientTop);
};
                

效果: