<pre><script type="text/javascript">
var x=10,y=10;
var timeout;
function loadsrc()
{
var objhi;
objhi=document.getElementById('obj1');
objhi.style.position="relative"; // move
objhi.style.top=100+y+"px";// up +1
y++;
var d = new Date();
var mes=d.getSeconds();
var h=d.getHours();
var minute=d.getMinutes();
var thang=d.getMonth();
var nam=d.getYear();
window.status="gio"+h+"phut"+minute+"giay"+mes+"thang:"+thang+nam;
timeout=setTimeout(loadsrc,100);// for with functionsetTimeout
}
html
<img id="obj1" src="co.jpg" height="100" width="100" /></img>
<a onclick="loadsrc()">chay</a>
<a onclick="dungsrc()">dung</a>
</pre>
No comments: