jQuery CSS 圖片指定位置 overlay table


<head>
<style>
table‹
z-index:1;

table, table td ‹
border: 1px solid red;

table td ‹
width: 150px;
height: 50px;

#img‹
position: absolute;
z-index:10

</style>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
<table cellpadding=0 cellspacing=0>
<tbody>
<tr><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td id="idtd"></td><td></td><td></td></tr>
</tbody>
</table>

<img id="img" src="roylosingature.png"/>
<script language="Javascript">
_pos = $('#idtd').offset();
$('#img').css(‹'top': _pos.top,'left': _pos.left›)
</script>
</body>

留言

熱門文章