<!DOCTYPE html>
<html>
<head>
<title>js9.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
</head>
<body>
<input id="openBtn" type="button" value="打开按钮">
<input id="closeBtn" type="button" value="关闭按钮">
<!-- 轮播图 -->
<img id="img" src="../Img/image.jpg" width="100%">
<input id="a_btn" type="button" value="刷新按钮">
<!-- histroy -->
<input type="button" id="btn" value="历史记录">
<a href="js8.html">js8网页</a>
<input type="button" id="forward" value="前进">
<script type="text/javascript">
var newWindow;
var openbtn=document.getElementById("openBtn");
openbtn.onclick=function()
{
newWindow=open("https://www.baidu.com");
}
var closebtn=document.getElementById("closeBtn");
closebtn.onclick=function()
{
newWindow.close("https://www.baidu.com");
}
var fun1=function()
{
alert("2秒时间到了");
}
var id=setTimeout(fun1,2000);
var id1=setInterval(fun1,2000);
clearTimeout(id);
clearInterval(id1);
var count=0;
var ImgChange =function changeImg()
{
var img= document.getElementById("img");
if(count==1)
{
img.src="../Img/img.jpg";
count++;
}
else
{
img.src="../Img/image.jpg";
count = 1;
}
}
setInterval(ImgChange,"3000");
var h1=history;
alert(h1);
window.document.getElementById("openBtn");
var flashBtn=document.getElementById("a_btn");
flashBtn.onclick=function()
{
location.reload();
locaton.href="https://ww.baidu.com";
}
var href=location.href;
alert(href);
var btn1=document.getElementById("forward");
btn1.onclick=function()
{
history.forward();
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>js10.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<style>
p
{
text-align:center;
}
span
{
color:red;
}
</style>
</head>
<body>
<p>
<span id="time">5</span>秒之后,自动跳转首页。。。
</p>
<script type="text/javascript">
var second=5;
var t=document.getElementById("time");
var time=function()
{
second--;
t.innerHTML=second+"";
if(second<=0)
{
location.href="https://www.baidu.com";
}
}
setInterval(time,1000);
</script>
</body>
</html>