下面是我的代码:怎么根据gdvalue的值设置它显示的颜色
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
%>
<html>
<head>
<title>股票信息</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<script type="text/javascript" src="/portalExternal/js/jquery.js"
charset="UTF-8"></script>
<script type="text/javascript">
/*获取stock.json里面的股票信息*/
$(document).ready(function() {
$.ajax({
url:"/portalExternal/stock.json",
type:"GET",
dataType:'json',
success:function(data){ wirteHtml(data);
},
error:function(){
alert("error");
}
});
});
function wirteHtml(data){
var htmlstr="";
$.each(data, function(index,value){
var row = $("#template_0").clone();
row.find("#name").text(value.name);
row.find("#dvalence").text(value.dvalence);
row.find("#gdvalue").html(value.gdvalue);
row.find("#gdrange").text(value.gdrange);
row.appendTo("#table");
});
}
</script>
</head>
<body>
<div id="stockMessage" style="overflow: hidden; height: 80px; width:500px; align: left">
<tbody>
<marquee style="WIDTH: 500px; HEIGHT: 80px" width=400 direction=up scrollamount=2 onmouseover="this.stop()"
onmouseout="this.start()" style="padding: 50px 10pt;" >
<table id="table" width="380" height="50" border="0" cellpadding="0" cellspacing="0">
<tr id="template_0">
<td align="center" width="200" id="name"></td>
<td align="center" width="100" id="dvalence"></td>
<td align="center" width="100" id="gdvalue"></td>
<td align="center" width="100" id="gdrange"></td>
</tr>
</table>
</marquee>
</tbody>
</div>
</body>
</html>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
%>
<html>
<head>
<title>股票信息</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<script type="text/javascript" src="/portalExternal/js/jquery.js"
charset="UTF-8"></script>
<script type="text/javascript">
/*获取stock.json里面的股票信息*/
$(document).ready(function() {
$.ajax({
url:"/portalExternal/stock.json",
type:"GET",
dataType:'json',
success:function(data){ wirteHtml(data);
},
error:function(){
alert("error");
}
});
});
function wirteHtml(data){
var htmlstr="";
$.each(data, function(index,value){
var row = $("#template_0").clone();
row.find("#name").text(value.name);
row.find("#dvalence").text(value.dvalence);
row.find("#gdvalue").html(value.gdvalue);
row.find("#gdrange").text(value.gdrange);
row.appendTo("#table");
});
}
</script>
</head>
<body>
<div id="stockMessage" style="overflow: hidden; height: 80px; width:500px; align: left">
<tbody>
<marquee style="WIDTH: 500px; HEIGHT: 80px" width=400 direction=up scrollamount=2 onmouseover="this.stop()"
onmouseout="this.start()" style="padding: 50px 10pt;" >
<table id="table" width="380" height="50" border="0" cellpadding="0" cellspacing="0">
<tr id="template_0">
<td align="center" width="200" id="name"></td>
<td align="center" width="100" id="dvalence"></td>
<td align="center" width="100" id="gdvalue"></td>
<td align="center" width="100" id="gdrange"></td>
</tr>
</table>
</marquee>
</tbody>
</div>
</body>
</html>
{
$("#gdvalue").css("background-color","red");
}