还没用过PNG来当透明图,通常只用GIF,可能是颜色位数不同,所以很多人喜欢用PNG。但听说IE对PNG透明图支持不好。你最好把代码和图片地址帖出来,方便大家帮你找原因。

解决方案 »

  1.   

    <script language="javascript" type="text/javascript">
    function correctPNG()
       {
       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='scale');\"></span>"
           img.outerHTML = strNewHTML
           i = i-1
            }
          }
       }
    window.attachEvent("onload", correctPNG);
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>无标题页</title>
    </head>
    <body>    
        <form id="form1" runat="server">
            &nbsp;<img src="images/jggz/a1.png" /><div>
                &nbsp;</div>
        </form>
       
        
    </body>
    </html>
      

  2.   

    不加script就可以看见图片 加了就看不见了
      

  3.   

    再来一个生成页面的原文件<script language="javascript" type="text/javascript">
    function correctPNG()
       {
       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='scale');\"></span>"
           img.outerHTML = strNewHTML
           i = i-1
            }
          }
       }
    window.attachEvent("onload", correctPNG);
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1"><link href="App_Themes/%E9%BB%98%E8%AE%A4%E4%B8%BB%E9%A2%98/StyleSheet.css" type="text/css" rel="stylesheet" /><title>
    无标题页
    </title></head>
    <body>    
        <form name="form1" method="post" action="测试.aspx" id="form1">
    <div>
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNzgzNDMwNTMzZGRkKep7mTQi4w74cTQ9bryWyEdmQA==" />
    </div>        &nbsp;<img src="images/jggz/a1.png" /><div>
                &nbsp;</div>
        </form>
       
        
    </body>
    </html>
      

  4.   

    原来是加滤镜啊~~滤镜俺不熟~~~调试的方法是,看看js执行过后html代码变成什么样子了~~
    <input type="button" onclick="alert(document.body.innerHTML)" />
    看看图片还在不在~~在确定图片还在的情况下,如果说看不见了可能是透明度设置成100%透明了吧~~?