<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Page</title>
<style type="text/css">
.img
{
width:120px; height:140px; border-width:1px; border-style:solid; border-color:Red;
}
</style>
<script type="text/javascript" src="JSLib/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
function file_change(file){
file.select();
var src = document.selection.createRange().text;
$("#img_pic").css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+src+", sizingMethod=scale)");
}
</script>
</head>
<body>
<form method="post" action="#">
<br />
<div class="img" id="img_pic"></div>
<input type="file" name="my_file" onpropertychange="file_change(this)" />
</form>
</body>
</html>
AlphaImageLoader兼容性:IE5.5+
语法:
filter : progid:DXImageTransform.Microsoft.AlphaImageLoader ( enabled=bEnabled , sizingMethod=sSize , src=sURL )
属性:
enabled :
可选项。布尔值(Boolean)。设置或检索滤镜是否激活。true | false
true
:
默认值。滤镜激活。
false
:
滤镜被禁止。
sizingMethod
:
可选项。字符串(String)。设置或检索滤镜作用的对象的图片在对象容器边界内的显示方式。
crop
:
剪切图片以适应对象尺寸。
image
:
默认值。增大或减小对象的尺寸边界以适应图片的尺寸。
scale
:
缩放图片以适应对象的尺寸边界。
src
:
必选项。字符串(String)。使用绝对或相对 url 地址指定背景图像。假如忽略此参数,滤镜将不会作用。
特性:
Enabled
:
可读写。布尔值(Boolean)。参阅 enabled 属性。
sizingMethod
:
可读写。字符串(String)。参阅 sizingMethod 属性。
src
:
可读写。字符串(String)。参阅 src 属性。
说明:
在对象容器边界内,在对象的背景和内容之间显示一张图片。并提供对此图片的剪切和改变尺寸的操作。如果载入的是PNG(Portable Network Graphics)格式,则0%-100%的透明度也被提供。
PNG(Portable Network Graphics)格式的图片的透明度不妨碍你选择文本。也就是说,你可以选择显示在PNG(Portable Network Graphics)格式的图片完全透明区域后面的内容。
示例:
#idDiv{position:absolute; left:140px; height:400; width:400;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='rain1977.gif',sizingMethod='scale');}
.dream{filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/earglobe.gif');}
让DIV背景图和自适应DIV的宽和高的上传图片例子
最新推荐文章于 2023-11-28 11:56:00 发布