diff options
author | matthew <matthew> | 2006-09-21 21:22:12 +0000 |
---|---|---|
committer | matthew <matthew> | 2006-09-21 21:22:12 +0000 |
commit | 8c64dc2d4a6bf21abe87bdcc13d86646585636c4 (patch) | |
tree | 7c7c9eb8dce7e308e7d9bca523011e23bbd7bd77 /web/pngfix.js | |
parent | 18c5c4a4076f471ac5306e48b066f4cfa8b3f3cb (diff) |
Fix PNGs in IE; add comment form.
Diffstat (limited to 'web/pngfix.js')
-rw-r--r-- | web/pngfix.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/web/pngfix.js b/web/pngfix.js new file mode 100644 index 000000000..6552a4b47 --- /dev/null +++ b/web/pngfix.js @@ -0,0 +1,37 @@ +/* + + Correctly handle PNG transparency in Win IE 5.5 & 6. + http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006. + + Use in <HEAD> with DEFER keyword wrapped in conditional comments: + <!--[if lt IE 7]> + <script defer type="text/javascript" src="pngfix.js"></script> + <![endif]--> + + */ + +var arVersion = navigator.appVersion.split("MSIE") +var version = parseFloat(arVersion[1]) + +if ((version >= 5.5) && (document.body.filters)) { + for(var i=0; i<document.images.length; i++) { + var img = document.images[i] + var imgName = img.src.toUpperCase() + if (imgName.substring(imgName.length-3, imgName.length) == "PNG") { + var imgID = (img.id) ? "id='" + img.id + "' " : "" + var imgClass = (img.className) ? "class='" + img.className + "' " : "" + var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " + var imgStyle = "display:inline-block;" + img.style.cssText + if (img.align == "left") imgStyle = "float:left;" + imgStyle + if (img.align == "right") imgStyle = "float:right;" + imgStyle + if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle + var strNewHTML = "<span " + imgID + imgClass + imgTitle + + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + + "(src=\'" + img.src + "\', sizingMethod='image');\"></span>" + img.outerHTML = strNewHTML + i = i-1 + } + } +} + |