图片360度倒转效果网页特效,用按钮控制90度旋转

<scriptlanguage="javascript">
varisIE=(document.uniqueID)?1:0;
vari=1;
functionrotate(image)
{
varobject=image.parentNode;
if(isIE){
image.style.filter="progid:dXImagetransform.Microsoft.basicImage(rotation="+i+")";
i++;
if(i>4){i=1};
}
else{
try{
varcanvas=document.createElement('canvas');
if(canvas.getContext("2d")){
object.replaceChild(canvas,image);
varcontext=canvas.getContext("2d");
context.translate(176,0);
context.rotate(Math.PI*0.5);
context.drawImage(image,0,0);
}
}catch(e){}
}
}
</script>
<imgid="myimg"src="http://www.corange.cn//uploadfiles/0_87641.jpg"/><br/>
<inputtype="button"value="rotate"onclick="rotate(document.getElementById('myimg'))"/>

你可能感兴趣的:(JavaScript,Microsoft,360)