<img id="a" style="height:100px;width:100px;" />
<script>
function setDeg(e,deg){
if(e.filters){
e.fw=e.fw||e.offsetWidth/2,e.fh=e.fh||e.offsetHeight/2;
var f = "DXImageTransform.Microsoft.Matrix";
if(!e.filters[f])e.style.filter+="progid:"+f+"(sizingmethod='auto expand')";
var rd=deg*Math.PI/180,pc=Math.cos(rd),ps=Math.sin(rd);
with(e.filters[f])M11=pc,M12=-ps,M21=ps,M22=pc;
var adr=(90-deg%90)*Math.PI/180,adp=Math.sin(adr)+Math.cos(adr);
with(e.style)marginTop=e.fh-adp*e.fh+"px",marginLeft=e.fw-adp*e.fw+"px";
}else e.style.MozTransform="rotate("+deg+"deg)";
};
var a=document.getElementById("a"),i=0;
setInterval(function(){
setDeg(a,i+=5);
},10);
</script>