tableCellOffset.html
1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<script type="text/javascript" src="jquery-1.3.2.js"></script>
<script type="text/javascript">
jQuery(function() {
var firstLefts = [];
var secondLefts = [];
jQuery("#first td").each(function() {
firstLefts.push(jQuery(this).offset().left);
});
jQuery("#second td").each(function() {
secondLefts.push(jQuery(this).offset().left);
});
for (var i in firstLefts) {
alert(i + ":" + firstLefts[i] + "?=" + secondLefts[i]);
alert(firstLefts[i] == secondLefts[i]);
}
});
</script>
</head>
<body>
<table>
<tr id="first">
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr id="second">
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
</table>
</body>
</html>