如何获取datadrid某一列对其进行格式化
1个回答
展开全部
<!DOCTYPE HTML>
<html>
<head>
<title>yugi</title>
<meta charset=UTF-8 />
<style type="text/css">
* {
margin: 0;
padding: 0;
}
table {
margin: auto;
width: 800px;
border: 1px solid black;
border-collapse: collapse;
}
th,td {
text-align: center;
border: 1px solid black;
}
</style>
<script type="text/javascript">
function load (path)
{
var xmlhttp = null;
if (window.ActiveXObject)
{
xmlhttp = new ActiveXObject ("Microsoft.XMLHttp");
}
else if (document.implementation && document.implementation.createDocument)
{
xmlhttp = new window.XMLHttpRequest ();
}
xmlhttp.open ("GET", path, false);
xmlhttp.send (null);
return xmlhttp;
}
onload = function ()
{
var result = load ("被和谐,自己加url");
var r = eval ("(" + result.response + ")");
var forecast = r.data.forecast;
var tb = table.tBodies[0];
var title = [
"date", "fengli", "fengxiang", "high", "low", "type"
];
for ( var i = 0; i < forecast.length; i++)
{
var fi = forecast[i];
var tr = tb.insertRow (tb.rows.length);
for ( var j = 0; j < title.length; j++)
{
var td = tr.insertCell (tr.cells.length);
td.innerHTML = fi[title[j]];
}
}
}
</script>
</head>
<body>
<table id="table">
<tr>
<th>日期</th>
<th>空搭风力<局吵/th>
<th>风向</th>
<th>最高温度</th>
<桐亏侍th>最低温度</th>
<th>类型</th>
</tr>
</table>
</body>
</html>
<html>
<head>
<title>yugi</title>
<meta charset=UTF-8 />
<style type="text/css">
* {
margin: 0;
padding: 0;
}
table {
margin: auto;
width: 800px;
border: 1px solid black;
border-collapse: collapse;
}
th,td {
text-align: center;
border: 1px solid black;
}
</style>
<script type="text/javascript">
function load (path)
{
var xmlhttp = null;
if (window.ActiveXObject)
{
xmlhttp = new ActiveXObject ("Microsoft.XMLHttp");
}
else if (document.implementation && document.implementation.createDocument)
{
xmlhttp = new window.XMLHttpRequest ();
}
xmlhttp.open ("GET", path, false);
xmlhttp.send (null);
return xmlhttp;
}
onload = function ()
{
var result = load ("被和谐,自己加url");
var r = eval ("(" + result.response + ")");
var forecast = r.data.forecast;
var tb = table.tBodies[0];
var title = [
"date", "fengli", "fengxiang", "high", "low", "type"
];
for ( var i = 0; i < forecast.length; i++)
{
var fi = forecast[i];
var tr = tb.insertRow (tb.rows.length);
for ( var j = 0; j < title.length; j++)
{
var td = tr.insertCell (tr.cells.length);
td.innerHTML = fi[title[j]];
}
}
}
</script>
</head>
<body>
<table id="table">
<tr>
<th>日期</th>
<th>空搭风力<局吵/th>
<th>风向</th>
<th>最高温度</th>
<桐亏侍th>最低温度</th>
<th>类型</th>
</tr>
</table>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询