jsダイナミック取得DIv高さ

484 ワード

<input type="button" onclick="getDivHeight()" value="getHeight"/>

function getDivHeight(){
	var popObj = document.createElement("div");
	document.body.appendChild(popObj);
	popObj.innerHTML="<div style='width:200px;height:100px;'>   </div>";
	alert("height:"+popObj.scrollHeight + "
" + "width:"+popObj.scrollWidth); }