設定元素位置
<!DOCTYP html>
<html>
<head>
<meta charset="UTF-8" >
<script>
</script>
<
<script>
function position()
{
var x = pic.offsetLeft;
var y = pic.offsetTop;
document.getElementById("pic2").style.position = "absolute";
document.getElementById("pic2").style.left = ( x + 150 );
document.getElementById("pic2").style.top = ( y + 150) ; ;
console.log(pic2.offsetLeft + "," + pic2.offsetTop);
}
</script>
</head>
<body onresize="position()" onload="position()">
<table width="100%" border="1">
<tr><td width="50%"> </td><td width="50%"> </td></tr>
</table>
<img src="c:\Chrysanthemum.jpg" id="pic" width="300" height="300" style="position:absolute;margin-left:50%;z-index:5;min-width:300px;min-height:300px;" >
<img src="c:\Penguins.jpg" width="10" height="10" id="pic2" style="z-index:5;" />
</img>
</body>
</html>