☺
<br> var style=document.getElementById("face").style;<br> var move=functon(){<br> style.left=Math.floor(Math.random()*500)+'px';<br> style.top=Math.floor(Math.random()*400)+'px';</p> <pre><code> } setInterval(move,2000); </script> </code></pre> <p></body></p>
<div id="face" style="position:absolute">☺</div><!--要absolute,fixed,relative定位设置left/top才有用-->
<script>
var style=document.getElementById("face").style;
///////var move=functon(){
var move=function(){//
style.left=Math.floor(Math.random()*500)+'px';
style.top=Math.floor(Math.random()*400)+'px';
}
setInterval(move,2000);
</script>