JavaScript实现图片旋转
<body>
<img src="2.jpg"><br>
<input type=button value="放大" onclick="large()">
<input type=button value="缩小" onclick="small()">
<input type=button value="旋转" onclick="rotate()">
<input type=button value="打印" onclick="printPic()">
</body>
<script>
var img=document.getElementsByTagName('img')[0];
function small()
{
img.width=img.width*0.5;
img.height=img.height*0.5;
}
function large()
{
img.width=img.width*2;
img.height=img.height*2;
}
function rotate()
{
//rotation: 1 旋转90度 ;2 旋转180度 ;3 旋转270度
img.style.filter='progid:DXImageTransform.Microsoft.BasicImage(rotation=1)'
}
function printPic()
{
window.print();
}
</script>