1.在div的id为down_right的div中加载另外一个html文件
<a href="login_later_first.html" target="lipan">网络接口</a>
<div id="down-right">
<iframe name="lipan" style="height:470px; width:842px" id="li" ></iframe>
</div>
2.在div中直接加载html文件的方法
<div id="down-right" >
<iframe name="lipan" style="height:470px; width:842px" id="li"
src="login_later_first.html"></iframe>
</div>
3.定时刷新
在body中直接使用onload方法表示在打开页面时就调用该方法
function loadTime(){
/*setInterval方法是每隔一段时间执行一次*/
window.setInterval("timely()",1000);
}
function timely(){
var date = new Date();
var day = date.getDate();//不是geDay 用来计算星期几
var month = date.getMonth()+1;
var year = date.getFullYear();
var hours = date.getHours();
var minn = date.getMinutes();
var second = date.getSeconds();
var times = year+ "年" + month + "月" + day + "日 " + hours + ":" + minn+":" + second;
document.getElementById("nowTime").innerHTML = times;
document.getElementById("times").innerHTML = date.toLocaleDateString();
}
function setTimeOuts(){
window.setTimeout("timely1()",1000); /*延迟*/
window.setTimeout("multime()",500);
}
function timely1(){
var date = new Date();
var day = date.getDate();//不是geDay 用来计算星期几
var month = date.getMonth()+1;
var year = date.getFullYear();
var hours = date.getHours();
var minn = date.getMinutes();
var second = date.getSeconds();
var times = year+ "年" + month + "月" + day + "日 " + hours + ":" + minn+":" + second;
document.getElementById("nowTime").innerHTML = times;
document.getElementById("times").innerHTML = date.toLocaleDateString();
window.setTimeout("timely1()",1000);/*自己调用自己*/
}
//window.onload=setTimeOuts();//跟onloade的效果一样
</script>
</head>
<body onload="setTimeOuts()"><!--这里如果使用onload="setTimeOuts()",那么setTimeOuts()函数体内必须添加语句 window.setTimeout("timely1()",1000); ,但是如果这里使用onload=LoadTime(),那么LoadTime()函数体里只需添加window.setInterval("timely()",1000);-->
当前时间为:
<label id="nowTime" >你好</label>
<br />
时间:
<label id="times" ></label><br/>
<label id="countTime" >hehe</label>
4.页面重新加载
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>自动刷新页面</title>
<script language="javascript">
times = 0;
document.getElementById("times").value = times;
function loadtimes(){
times ++;
// document.getElementById("times").value = times;
window.location.reload;//重新刷新当前页面
document.getElementById("times").value = times;
}
</script>
</head>
<body >
<input type="text" id="times" value="0" />
<input type="button" onclick="loadtimes()" value="but" />
</body>
</html>
5.点击按钮后改变按钮的背景图片
document.getElementById("sys").style.backgroundImage="url(img/black.jpg)";