-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path18.html
More file actions
118 lines (107 loc) · 1.76 KB
/
18.html
File metadata and controls
118 lines (107 loc) · 1.76 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
39
40
41
42
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>新闻</title>
<script src="jquery.js"></script>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
.box{
border: 1px solid #ccc;
width: 606px;
margin:auto;
padding:auto;
}
.box ul{
overflow: hidden;
}
.box ul li{
margin:3px;
text-align:center;
list-style-type: none;
border:1px solid #ccc;
width:190px;
height: 50px;
line-height: 50px;
background: #ccc;
float:left;
}
.box .content{
width: 100%;
height: 400px;
font: 35px;
text-align: center;
}
table{
border:1px solid #ccc;
margin:auto;
}
</style>
</head>
<body>
<div class="tabale" >
<table>
<tr>
<td>ID</td>
<td>name</td>
<td>sex</td>
<td>age</td>
<td>edu</td>
<td>salary</td>
<td>bonus</td>
<td>city</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</div>
<div class="box">
<ul>
<li id="0">新闻标题</li>
<li id="1">新闻标题</li>
<li id="2">新闻标题</li>
</ul>
<div class="content">
</div>
</div>
</body>
<script type="text/javascript">
$("li").mouseover(function () {
//鼠标经过变色,然后调用Ajax
$(this).css("background","#fff")
var cid=$(this).attr("id")
dat='cid='+cid;
/*
*jquery封装的Ajax
*/
$.ajax({
url:"1.php",
type:'post',
data:dat,
//回调函数
success: function (res) {
console.log( res)
var content=$("div")[1]
$("ul").last().after(content)
content.innerHTML=res
},
// dataType:"json"
});
});
//鼠标移开变色#ccc
$("li").mouseleave(function () {
$(this).css("background","#ccc")
})
</script>
</html>