讓 IE 可以處理透明 PNG 圖形
參考來源:PNG in Windows IE
適合有架設網站的人士使用。指令碼只針對 IE 5.5/6 處理,其餘瀏覽器自動忽略。
1. 下載 pngfix.js 檔案,儲存到適當的地方。
2. 將以下敘述加至 區段。放在其餘地方也可以,但是不建議。
HTML 代碼:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | <script src="pngfix.js" default type="text/javascript"> /* Correctly handle PNG transparency in Win IE 5.5 & 6. http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006. Use in with DEFER keyword wrapped in conditional comments: <script src="" defer type=""></SCRIPT> */ 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; img.src.touppercase() if (imgname.substring(imgname.length-3, imgname.length)="=" (img.id) ? "id="" + img.id + "" (img.classname) ? "class="" + img.classname + "" (img.title) ? "title="" + img.title + "" " : "title="" + img.alt + "" "display:inline-block;" + img.style.csstext if (img.align="=" "float:left;" + imgstyle if (img.align="=" > + " style="" + "width:" + img.width + "px; height:" + img.height + "px;" + imgstyle + ";" + "filter:progid:dximagetransform.microsoft.alphaimageloader" + "(src="" + img.src + "', sizingmethod="scale">" img.outerHTML = strNewHTML i = i-1 } } } </script> |