📄 htmlpage.htm
字号:
<!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>
<title>无标题页</title>
<script type="text/javascript">
var xmlhttp;
function createHTTP()
{
//根据不同的浏览器创建XMLHttpRequest
if(window.ActiveXObject)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
}
//开始调用
function startHTTP()
{
//创建对象
createHTTP();
//状态变化与事件挂钩
xmlhttp.onreadystatechange=StateDO;
//获取XML文件的数据
xmlhttp.open("GET","XMLFile.xml",true);
//不带任何参数
xmlhttp.send(null);
}
function StateDO()
{
//判断是否是完成状态
if(xmlhttp.readystate==4)
{
//判断是否执行成功
if(xmlhttp.status==200)
{
//更新页面上的某元素
document.getElementById("mytext").innerHTML=xmlhttp.responsetext;
}
}
}
</script>
</head>
<body>
<div style="DIRECTION: ltr; LETTER-SPACING: normal; POSITION: static; BACKGROUND-COLOR: #cc99ff; TEXT-ALIGN: center" id="mytext">这是旧数据</div>
<input type="button" value="更新DIV" onclick="startHTTP()" />
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -