去掉IE6图片有白底办法
2012-11-21 14:08:32 来源:WEB开发网核心提示:下面这种是需要有JQUERY <!--[if IE 6]> <script type="text/javascript"> $(document).ready(function() { $("img").each(fu
下面这种是需要有JQUERY
<!--[if IE 6]>
<script type="text/javascript">
$(document).ready(function() {
$("img").each(function()
{
var imgName = this.src.toUpperCase();
if (imgName.substring(imgName.length - 3, imgName.length) == "PNG")
{
var imgID = (this.id) ? "id='" + this.id + "' " : "";
var imgClass = (this.className) ? "class='" + this.className + "' " : "";
var imgTitle = (this.title) ? "title='" + this.title + "' " : "title='" + this.alt + "' ";
var imgStyle = "display:inline-block;" + this.style.cssText;
if (this.align == "left") imgStyle = "float:left;" + imgStyle;
if (this.align == "right") imgStyle = "float:right;" + imgStyle;
if (this.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style=\"" + "width:" + this.width + "px; height:" + this.height + "px;" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src=\'" + this.src + "\', sizingMethod='image');\"></span>";
this.outerHTML = strNewHTML;
}
});
});
</script>
<![endif]-->
更多精彩
赞助商链接
