1
<script language=javascript>
2
var xmlhttp;
3
function createXmlhttp()
4
{
5
if(window.ActiveXObject)
6
{
7
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
8
}
9
else if(window.XMLHttpRequest())
10
{
11
xmlhttp=new XMLHttpRequest()
12
}
13
}
14
function getTxt(n)
15
{
16
createXmlhttp();
17
xmlhttp.open("get","http://127.0.0.1/table.asp?tableid="+n,"true");
18
xmlhttp.onreadystatechange=callBack;
19
xmlhttp.send(null);
20
}
21
function callBack()
22
{
23
if(xmlhttp.readyState==4)
24
{
25
if(xmlhttp.status==200)
26
{
27
//
28
document.getElementById("test").innerHTML=xmlhttp.responseText;
29
}
30
}
31
}
32
33
function secBoard(n)
34

{
35
for(i=0;i<secTable.cells.length;i++)
36
secTable.cells[i].className="sec1";
37
secTable.cells[n].className="sec2";
38
}
43
</script>
44
<style type=text/css>
45
td {
}{
46
font-size: 12px;
47
color: #000000;
48
line-height: 150%;
49
}
50
.sec1 {
}{
51
background-color: #EEEEEE;
52
cursor: hand;
53
color: #000000;
54
border-left: 1px solid #FFFFFF;
55
border-top: 1px solid #FFFFFF;
56
border-right: 1px solid gray;
57
border-bottom: 1px solid #FFFFFF
58
}
59
.sec2 {
}{
60
background-color: #D4D0C8;
61
cursor: hand;
62
color: #000000;
63
border-left: 1px solid #FFFFFF;
64
border-top: 1px solid #FFFFFF;
65
border-right: 1px solid gray;
66
font-weight: bold;
67
}
68
.main_tab {
}{
69
background-color: #D4D0C8;
70
color: #000000;
71
border-left:1px solid #FFFFFF;
72
border-right: 1px solid gray;
73
border-bottom: 1px solid gray;
74
}
75
</style>
76
77
<table border=0 cellspacing=0 cellpadding=0 width=549 id=secTable>
78
<tr height=20 align=center>
79
<td class=sec2 width=10% onclick="secBoard(0);getTxt(0)">关于TBODY标记</td>
80
<td class=sec1 width=10% onclick="secBoard(1);getTxt(1)">关于cells集合</td>
81
<td class=sec1 width=10% onclick="secBoard(2);getTxt(2)">关于tBodies集合</td>
82
<td class=sec1 width=10% onclick="secBoard(3);getTxt(3)">关于display属性</td>
83
</tr>
84
</table>
85
<table border=0 cellspacing=0 cellpadding=0 width=549 height=240 id=mainTable class=main_tab>
86
<tbody>
87
<tr>
88
<td align=center valign=top ><div id="test">默认内容 </div>
89
</td>
90
</tr>
91
</tbody>
92
</table>
Table.asp代码如下:


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

43

44



45



46

47

48

49

50



51

52

53

54

55

56

57

58

59



60

61

62

63

64

65

66

67

68



69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

1
<%
2
if request.QueryString("tableid")<>"" then
3
dim tableid
4
tableid=request.QueryString("tableid")
5
6
select case tableid
7
case 0
8
response.Write("<p>table1</p>")
9
case 1
10
response.Write("<p>table2</p>")
11
case 2
12
response.Write("<p>table3</p>")
13
case 3
14
response.Write("<p>table4</p>")
15
end select
16
else
17
response.Write("Error")
18
end if
19
20
%>
简单实现.

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20
