<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>节点集合</title>
</head>
<body>
<form action="">
<input type="text" name='username'>
<input type="password" name='password'>
</form>
<form action="">
<input type="text" name='user'>
<input type="text" name='pass'>
<select name="" id="">
<option value="0">北京</option>
</select>
<textarea name="" id="" cols="30" rows="10"></textarea>
</form>
<form action=""></form>
<a href="http://www.baidu.com">百度</a>
<a href="http://www.qq.com">腾讯</a>
<a href="http://www.taobao.com">淘宝</a>
<img src="./sunli/1.jpg" alt="">
<img src="./sunli/2.jpg" alt="">
<img src="./sunli/3.jpg" alt="">
<script type="text/javascript">
//获取所有的form表单元素 返回的是一个数组
var forms = document.forms;
//elments 获取表单里面的元素 所有的
var f = forms[1].elements;
f[1].onblur = function()
{
this.style.border = 'solid 1px blue';
}
//====================================
//name
var tx = forms[0].password;
tx.onblur = function()
{
this.style.width = '500px';
}
//获取页面中所有的a标签 返回的结果是一个数组
var as = document.links;
// as[2].onclick = function()
// {
// //通过属性href的方式进行改变href路径
// // location.href = './form.html';
// //通过方法 进行跳转
// location.replace('./bak.html');
// //阻止默认行为
// return false;
// }
//遍历
for(var i = 0; i < as.length; i++){
as[i].onclick = function()
{
location.href = './bak.html';
//阻止默认行为
return false;
}
}
//获取页面中所有的img标签 返回的结果是一个数组
var imgs = document.images;
// console.log(imgs);
// imgs[1].setAttribute('src','./sunli/6.jpg');
//定时器
setInterval(function(){
// imgs[0].src = './sunli/'+rand(1,13)+'.jpg';
// imgs[1].src = './sunli/'+rand(1,13)+'.jpg';
// imgs[2].src = './sunli/'+rand(1,13)+'.jpg';
for (var i = 0; i < imgs.length; i++) {
imgs[i].setAttribute('src','./sunli/'+rand(1,13)+'.jpg');
};
},1000)
function rand(m,n){
return Math.ceil(Math.random()*(n-m+1))+(m-1);
}
</script>
</body>
</html>