<html>
<head>
<meta charset="UTF-8">
<title></title>
<script>
function bt(){
//关闭页面
window.close();
}
function open1(){
window.open("02setTimeOut.html","user",'width=500,height=300');
}
</script>
</head>
<body>
<a href="aa.html">点我进行跳转</a>
<button οnclick="bt()">点我关闭</button>
<button οnclick="open1()">点我开启一个页面</button>
</body>
</html>
---------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script>
//第一个参数是方法。第二个参数是延时的毫秒数 ,只会执行一次方法体
/*setTimeout(function(){
alert("我是settimeout");
},2000);*/
//多次执行方法体
var inter = setInterval(function(){
//alert("我是setInterval");
var t = new Date();
//var a = new Date
var time = t.toLocaleTimeString();
document.getElementById("p1").innerHTML=time;
},2000);
//停止时间的操作
function bt(){
clearInterval(inter);
}
</script>
</head>
<body>
<!--//展示时间的 2018 1 29 11 50-->
<p id="p1"></p>
<button οnclick="bt()">停止</button>
</body>
</html>
---------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<input type="text" value="aaaaa" id="input1"/>
<p id="p1" style="background-color: red;"></p>
<p title="1511r" id="p2">aaaaa</p>
<a href="http://www.baidu.com" id="a1">点我跳转</a>
<button οnclick="bt()">改变链接</button>
<script>
//获得html里面的值
function getvalu(){
var value = document.getElementById("input1").value;
alert(value);
}
//获得属性的值
function getAttr(){
var title = document.getElementById("p2").getAttribute("title");
alert(title);
}
//改变html里面的属性
function bt(){
document.getElementById("a1").href="http://www.qq.com";
//不建议使用
//document.getElementsByTagName("a").href ="http://www.qq.com";
}
/* document.getElementById("p1").innerHTML="你好";
document.getElementById("p1").style.height="300px";*/
//getAttr();
//getvalu();
</script>
</body>
</html>