日期:2014-05-17 浏览次数:20510 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript" type="text/javascript">
var json = [
{"城市":"北京","面积":16800,"人口":1600},
{"城市":"上海","面积":6400,"人口":1800},
{"城市":"广州","面积":3400,"人口":3400},
{"城市":"杭州","面积":3900,"人口":6500},
{"城市":"福州","面积":2100,"人口":2200},
{"城市":"深圳","面积":4600,"人口":12000},
{"城市":"温州","面积":500,"人口":5700}
];
function doLoad2()
{
document.getElementById("city").innerHTML=json[0].城市+"-"+json[1].城市+"-"+json[2].城市;
document.getElementById("inputText").value=0;
}
function doShow(i)
{
var a=document.getElementById("inputText").value;
if(i==0)
{
if(a=="0")
{
return ;
}
var b=a*1+1*1;
var c=a*1+2*1;
document.getElementById("city").innerHTML=json[a].城市+"-"+json[b].城市+"-"+json[c].城市;
a--;
document.getElementById("inputText").value=a;
}
if(i==1)
{
if(a==(json.length-3))
{
return;
}
var b=a*1+1*1;
var c=a*1+2*1;
document.getElementById("city").innerHTML=json[a].城市+"-"+json[b].城市+"-"+json[c].城市;
a++;
document.getElementById("inputText").value=a;
}
}
</script>
</head>
<body onload="doLoad2()">
<input type="hidden" value="0" id="inputText" />
<div i