图片按照任意角度旋转(至少能够按照90度旋转)——有较大难度,能解决问题就是牛 Rotation:http://msdn.microsoft.com/workshop/author/filter/reference/properties/rotation.asp 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用CSS实现.旋转任意角度,<style>#idDiv{width:290px;text-align:left;padding:6px;background-color:#000000;font-family:tahoma,Arial;filter:progid:DXImageTransform.Microsoft.Matrix(M11=1.0, sizingmethod="auto expand");}</style><script>var sFilter="filter : progid:DXImageTransform.Microsoft.Matrix(";var fM11,fM12,fM21,fM22,fDx,fDy,sType,sMethod;var oDiv,oCodeDiv,oTxtRotation,oBtnRotation;var i=0;function rdl_SetRotation(deg) {var deg2rad=Math.PI*2/360;rad=deg*deg2rad;costheta = Math.cos(rad);sintheta = Math.sin(rad);with (oDiv.filters.item(0)) {M11=costheta;M12=-sintheta;M21=sintheta;M22=costheta;}rdl_UpdateMatrix();}function rdl_DoAnimation(){oDiv.onfilterchange=rdl_DoAnimation;i+=5;if (i>359) {i=0;oDiv.onfilterchange=null;}rdl_SetRotation(i);}function rdl_UpdateMatrix() {with (oDiv.filters.item(0)) {fM11=Math.round(M11*10)/10;fM12=Math.round(M12*10)/10;fM21=Math.round(M21*10)/10;fM22=Math.round(M22*10)/10;fDx=Math.round(Dx*10)/10;fDy=Math.round(Dy*10)/10;sType=FilterType;sMethod=SizingMethod;}oCodeDiv.innerText=sFilter+"SizingMethod="+sMethod+",FilterType="+sType+",Dx="+fDx+",Dy="+fDy+",M11="+fM11+",M12="+fM12+",M21="+fM21+",M22="+fM22+");";}function rdl_Load(e){oDiv=document.all("idDiv");oCodeDiv=document.all("idCodeDiv");oTxtRotation=document.all("idTxtRotation");oBtnRotation=document.all("idBtnRotation");var oSelType=document.all("idSelType");var oSelSize=document.all("idSelSize");oSelType.onchange=new Function("with (this) oDiv.filters.item(0).filtertype=options(selectedIndex).value;rdl_UpdateMatrix();");oSelSize.onchange=new Function("with (this) oDiv.filters.item(0).SizingMethod=options(selectedIndex).value;rdl_UpdateMatrix();");oTxtRotation.onclick=new Function("if (this.value.length>4) this.value=0;");oBtnRotation.onclick=new Function("rdl_SetRotation(oTxtRotation.value);");rdl_UpdateMatrix();}function rdl_DoHFlip(e){with (oDiv.filters.item(0)) {M11=0-M11;M12=0-M12;}rdl_UpdateMatrix();}function rdl_DoVFlip(e){with (oDiv.filters.item(0)) {M21=0-M21;M22=0-M22;}rdl_UpdateMatrix();}window.onload=rdl_Load;</script><div id=idParentDiv><div id=idDiv><img src="http://expert.csdn.net/images/csdn.gif"></div></div><br><table><tr><td><input type=button value=左右反转 onclick="rdl_DoHFlip();"><input type=button value="上下反转" onclick="rdl_DoVFlip();"></td><td ><input id=idTxtRotation type=text value="输入角度数字" size=14></input> <input id=idBtnRotation type=button value="旋转"></td><td ><select id=idSelSize><option value="auto expand">auto expand</option><option value="clip to original">clip to original</option></select></td><td ><select id=idSelType><option value="bilinear">Bilinear</option><option value="nearest">Nearest Neighbour</option></select></td><td><input type=button value="动画" onclick="rdl_DoAnimation();"></td></tr></table><br><div id=idCodeDiv>filter</div> 用CSS实现,不用很牛也可以完成 昨天网络出现问题,所以一直没有上来,感谢大家。TO:fason(阿信):你的方法已经能够满足我的要求了,谢谢!TO:wanghr100(灰豆宝宝.net) :你的方法太爽了,谢谢!看来我的水平和大家有一定差距哈!:) 如何给标签中的title属性设置样式? 使用js 写个函数,判断输入的字符串是否是数值 一个很奇怪的问题,关于get提交的 关于setTimeout()的延迟执行问题! document.body.innerHTML;为什么不能取整个页面的全部内容? 如何打印框架结构的某个框架或者某一个iframe? 关于document.designMode="On"的问题. 高分求解 怎样让iframe调用父页面的javascript函数? onresize 怎么用啊? 关于table几问 关于ActiveXObject的详细资料??? 如何实现,点击按钮后,立刻让此按钮disabled,变成不可点击
#idDiv{width:290px;text-align:left;padding:6px;background-color:#000000;font-family:tahoma,Arial;filter:progid:DXImageTransform.Microsoft.Matrix(M11=1.0, sizingmethod="auto expand");}
</style>
<script>
var sFilter="filter : progid:DXImageTransform.Microsoft.Matrix(";
var fM11,fM12,fM21,fM22,fDx,fDy,sType,sMethod;
var oDiv,oCodeDiv,oTxtRotation,oBtnRotation;
var i=0;function rdl_SetRotation(deg) {
var deg2rad=Math.PI*2/360;
rad=deg*deg2rad;
costheta = Math.cos(rad);
sintheta = Math.sin(rad);
with (oDiv.filters.item(0)) {
M11=costheta;M12=-sintheta;M21=sintheta;M22=costheta;
}
rdl_UpdateMatrix();
}function rdl_DoAnimation(){
oDiv.onfilterchange=rdl_DoAnimation;
i+=5;
if (i>359) {
i=0;
oDiv.onfilterchange=null;
}
rdl_SetRotation(i);
}function rdl_UpdateMatrix() {
with (oDiv.filters.item(0)) {
fM11=Math.round(M11*10)/10;fM12=Math.round(M12*10)/10;fM21=Math.round(M21*10)/10;fM22=Math.round(M22*10)/10;
fDx=Math.round(Dx*10)/10;fDy=Math.round(Dy*10)/10;sType=FilterType;sMethod=SizingMethod;
}
oCodeDiv.innerText=sFilter+"SizingMethod="+sMethod+",FilterType="+sType+",Dx="+fDx+",Dy="+fDy+",M11="+fM11+",M12="+fM12+",M21="+fM21+",M22="+fM22+");";
}function rdl_Load(e){
oDiv=document.all("idDiv");
oCodeDiv=document.all("idCodeDiv");
oTxtRotation=document.all("idTxtRotation");
oBtnRotation=document.all("idBtnRotation");
var oSelType=document.all("idSelType");
var oSelSize=document.all("idSelSize");
oSelType.onchange=new Function("with (this) oDiv.filters.item(0).filtertype=options(selectedIndex).value;rdl_UpdateMatrix();");
oSelSize.onchange=new Function("with (this) oDiv.filters.item(0).SizingMethod=options(selectedIndex).value;rdl_UpdateMatrix();");
oTxtRotation.onclick=new Function("if (this.value.length>4) this.value=0;");
oBtnRotation.onclick=new Function("rdl_SetRotation(oTxtRotation.value);");
rdl_UpdateMatrix();
}function rdl_DoHFlip(e){
with (oDiv.filters.item(0)) {M11=0-M11;M12=0-M12;}
rdl_UpdateMatrix();
}function rdl_DoVFlip(e){
with (oDiv.filters.item(0)) {M21=0-M21;M22=0-M22;}
rdl_UpdateMatrix();
}window.onload=rdl_Load;
</script>
<div id=idParentDiv><div id=idDiv>
<img src="http://expert.csdn.net/images/csdn.gif">
</div></div><br>
<table><tr>
<td><input type=button value=左右反转 onclick="rdl_DoHFlip();"><input type=button value="上下反转" onclick="rdl_DoVFlip();"></td>
<td ><input id=idTxtRotation type=text value="输入角度数字" size=14></input> <input id=idBtnRotation type=button value="旋转"></td>
<td ><select id=idSelSize><option value="auto expand">auto expand</option><option value="clip to original">clip to original</option></select></td>
<td ><select id=idSelType><option value="bilinear">Bilinear</option><option value="nearest">Nearest Neighbour</option></select></td>
<td><input type=button value="动画" onclick="rdl_DoAnimation();"></td>
</tr></table>
<br>
<div id=idCodeDiv>filter</div>
TO:fason(阿信):你的方法已经能够满足我的要求了,谢谢!
TO:wanghr100(灰豆宝宝.net) :你的方法太爽了,谢谢!
看来我的水平和大家有一定差距哈!:)