时间自动增加
<script>
setInterval(function () {
dobj=new Date();
year=dobj.getFullYear();
month=dobj.getMonth();
day=dobj.getDate();
hour=dobj.getHours();
minute=dobj.getMinutes();
second=dobj.getSeconds();
str=year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;
h1obj=document.getElementById('mytime');
h1obj.innerHTML=str;
},1000);
</script>
捕获.PNG
图片变换
<img src="" id="imgid">
<script>
imobj=document.getElementById('imgid');
arr=['a.jpg','b.jpg','c.png','d.png','e.png'];
key=Math.floor(Math.random()*arr.length);
val=arr[key];
imobj=document.getElementById('imgid');
imobj.src=val;
</script>
网友评论