怎么对jquery里的html(0里的对象改变样式和其他操作呢,可以在html()里面用js,css吗?
<htmlxmlns="http://www.w3.org/1999/xhtml"><head><title>json</title><scripttype="text/...
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
json
</title>
<script type="text/javascript" src="jquery-1.6.2.js">
</script>
<style type="text/css">
.odd {
background-color:#CCFF00;
}
.stl {
border:thick;
border-collapse:collapse;
}
</style>
<script type="text/javascript">
$(function() {
$("#Button1").click(function() {
$.getJSON("UserInfo.json", function(data) {
$("#divTip").empty();
var str="<table class='sortable' id='userinfo'><tbody><tr><td>Name</td><td>Sex</td><td>Email</td></tr>";
$.each(data, function(InfoIndex, Info){
str=str + "<tr><td>" + Info["name"] + "</td><td>" + Info["sex"] + "</td><td>" + Info["email"] + "</td></tr>";
});
str = str + "</tbody></table>";
$("#divTip").append(str);
});
});
});
$("body").find(".sortable tbody tr:odd").addClass('odd');
$("body").find(".sortable tr:even").addClass('even');
$("body").find("#divTip table").addClass('stl')
</script>
<style type="text/css">
.stl {
border:thick;
border-collapse:collapse;
}
</style>
</script>
</head>
<body>
<div class="divFrame">
<div class="divTitle">
<input id="Button1" type="button" class="btn" value="获取数据" />
</div>
<div class="divContent">
<div id="divTip">
</div>
</div>
</div>
<script type="text/javascript">
$("body").find(".sortable tbody tr:odd").addClass('odd');
$("body").find(".sortable tr:even").addClass('even');
$("#divTip").find("table").addClass('stl')
</script>
<style type="text/css">
#div table{
border:thick;
}
</style>
</body>
</html>
那些js和样式都没有用,要怎么改呢 展开
<head>
<title>
json
</title>
<script type="text/javascript" src="jquery-1.6.2.js">
</script>
<style type="text/css">
.odd {
background-color:#CCFF00;
}
.stl {
border:thick;
border-collapse:collapse;
}
</style>
<script type="text/javascript">
$(function() {
$("#Button1").click(function() {
$.getJSON("UserInfo.json", function(data) {
$("#divTip").empty();
var str="<table class='sortable' id='userinfo'><tbody><tr><td>Name</td><td>Sex</td><td>Email</td></tr>";
$.each(data, function(InfoIndex, Info){
str=str + "<tr><td>" + Info["name"] + "</td><td>" + Info["sex"] + "</td><td>" + Info["email"] + "</td></tr>";
});
str = str + "</tbody></table>";
$("#divTip").append(str);
});
});
});
$("body").find(".sortable tbody tr:odd").addClass('odd');
$("body").find(".sortable tr:even").addClass('even');
$("body").find("#divTip table").addClass('stl')
</script>
<style type="text/css">
.stl {
border:thick;
border-collapse:collapse;
}
</style>
</script>
</head>
<body>
<div class="divFrame">
<div class="divTitle">
<input id="Button1" type="button" class="btn" value="获取数据" />
</div>
<div class="divContent">
<div id="divTip">
</div>
</div>
</div>
<script type="text/javascript">
$("body").find(".sortable tbody tr:odd").addClass('odd');
$("body").find(".sortable tr:even").addClass('even');
$("#divTip").find("table").addClass('stl')
</script>
<style type="text/css">
#div table{
border:thick;
}
</style>
</body>
</html>
那些js和样式都没有用,要怎么改呢 展开
2个回答
展开全部
如下修改
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
json
</title>
<script type="text/javascript" src="jquery.js"></script>
<style type="text/css">
.odd {
background-color:#CCFF00;
}
#div table{
border:thick;
}
.stl {
border:thick;
border-collapse:collapse;
}
</style>
<script type="text/javascript">
$(function() {
$("#Button1").click(function() {
$.getJSON("UserInfo.json", function(data) {
$("#divTip").empty();
var str="<table class='sortable' id='userinfo'><tbody><tr><td>Name</td><td>Sex</td><td>Email</td></tr>";
$.each(data, function(InfoIndex, Info){
str=str + "<tr><td>" + Info["name"] + "</td><td>" + Info["sex"] + "</td><td>" + Info["email"] + "</td></tr>";
});
str = str + "</tbody></table>";
$("#divTip").append(str);
});
$("body").find(".sortable tbody tr:odd").addClass('odd');
$("body").find(".sortable tr:even").addClass('even');
$("body").find("#divTip table").addClass('stl');
});
});
</script>
</head>
<body>
<div class="divFrame">
<div class="divTitle">
<input id="Button1" type="button" class="btn" value="获取数据" />
</div>
<div class="divContent">
<div id="divTip">
</div>
</div>
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
json
</title>
<script type="text/javascript" src="jquery.js"></script>
<style type="text/css">
.odd {
background-color:#CCFF00;
}
#div table{
border:thick;
}
.stl {
border:thick;
border-collapse:collapse;
}
</style>
<script type="text/javascript">
$(function() {
$("#Button1").click(function() {
$.getJSON("UserInfo.json", function(data) {
$("#divTip").empty();
var str="<table class='sortable' id='userinfo'><tbody><tr><td>Name</td><td>Sex</td><td>Email</td></tr>";
$.each(data, function(InfoIndex, Info){
str=str + "<tr><td>" + Info["name"] + "</td><td>" + Info["sex"] + "</td><td>" + Info["email"] + "</td></tr>";
});
str = str + "</tbody></table>";
$("#divTip").append(str);
});
$("body").find(".sortable tbody tr:odd").addClass('odd');
$("body").find(".sortable tr:even").addClass('even');
$("body").find("#divTip table").addClass('stl');
});
});
</script>
</head>
<body>
<div class="divFrame">
<div class="divTitle">
<input id="Button1" type="button" class="btn" value="获取数据" />
</div>
<div class="divContent">
<div id="divTip">
</div>
</div>
</div>
</body>
</html>
更多追问追答
追问
$("body").find(".sortable tbody tr:odd").addClass('odd');
$("body").find(".sortable tr:even").addClass('even');
$("body").find("#divTip table").addClass('stl');
还是没有实现……
追答
UserInfo.json 这个文件是什么 ?给出来
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询