当前位置: 代码迷 >> ASP.NET >> 開發 freetextbox 遇到的問題-该如何解决
  详细解决方案

開發 freetextbox 遇到的問題-该如何解决

热度:10208   发布时间:2013-02-26 00:00:00.0
開發 freetextbox 遇到的問題---急急!!!!
目前網上流行的freetextbox   在插入圖片後,圖片大小可以通過移mouse來改變width,height,現在我想做,在移動圖片width,height時能實現等比縮放。這個功能如何實現。

------解决方案--------------------------------------------------------
用js可以实现, freetextbox 就不知道能不能实现了。
不能的花你需要自己修改代码。
------解决方案--------------------------------------------------------
我记得好想见过类似的方法,有人的blog里有,但是实在忘了是那里见的了.
------解决方案--------------------------------------------------------
1.大小图片通吃

function DownImage(ImgD){
var image=new Image();
image.src=../../ImgD.src;
if(image.width> 0 && image.height> 0){
//flag=true;
if(image.width> =300){
ImgD.width=300;
ImgD.height=(image.height*300)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
}


图片如果宽度不大于300,原始大小显示,否则缩放大小。


2.真对大图片

<script language= "javascript ">
//图片处理函数
function changeImageSize(img) {
if(img.height > 90 || img.width > 90){
if(img.height > = img.width){
img.height=90;
} else {
img.width=90;
}
}
}
</script>


http://topic.csdn.net/t/20051026/09/4350582
http://www.chinaccna.com/www/aspnet/200605/13779