52,781
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<style>
.BUTTON A{
font-size:12PX;
text-align:center;
line-height:40PX;
vertical-align:middle;
color:#FFFFFF;
WIDTH:120PX;
HEIGHT:40PX;
background-color:#666666;
}
.d2,.d1,.output{width:150px;height:100px;background-color:#999999;}
.d2{
background-color:#993333;
}
.output{
background-color:#FFCC66;
color:#000000;
font-weight:bold;
}
</style>
</head>
<body>
<script>
var xmlhttp;
function changeDiv(num)
{ if(num==2)
{
document.getElementById("d1").style.display="none"
document.getElementById("d3").style.display=""
}
if(num==1)
{
document.getElementById("d1").style.display=""
document.getElementById("d3").style.display="none"
}
}
function getLR(type){
if(window.ActiveXObject)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
}
else
{
xmlhttp=new XMLHttpRequest();
}
xmlhttp.onreadystatechange = function(){
var cc=xmlhttp.readyState;
if(cc==4)
{
document.getElementById("output").innerHTML=xmlhttp.responseText;
}
};
if(type==1)
xmlhttp.open("get","1.txt",false)
else
xmlhttp.open("get","2.txt")
xmlhttp.send();
}
</script>
<DIV class="BUTTON">
<a href="javascript:changeDiv(1)">国际城市</a><a href="javascript:changeDiv(2)">国内城市</a>
</DIV>
<div class="d1" id="d1">
<input type="text" value="国际城市" onClick="getLR(1)">
</div>
<DIV class="d2" id="d3">
<input type="text" value="国内城市" onClick="getLR(2)">
</DIV>
<div class="output" id="output">
</div>
<script>
document.getElementById("d1").style.display=""
document.getElementById("d3").style.display="none"
</script>
</body>
</html>