SitePoint Sponsor

User Tag List

Results 1 to 1 of 1

Hybrid View

  1. #1
    SitePoint Evangelist
    Join Date
    Aug 2005
    Posts
    574
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Two scripts interfering

    I'm using this pngfix script:

    Code:
    /*
     
    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='scale');\"></span>" 
             img.outerHTML = strNewHTML
             i = i-1
          }
       }
    }
    And I have this javascript also on the page:
    Code:
    <script language="JavaScript" type="text/javascript">
    
    function confirmClientDelete (evt,msg) {
    var flag=window.confirm(msg);
    if (!flag) {
    if (evt.preventDefault) {evt.preventDefault();} else {evt.returnValue=false;};	
    }
    };
      
    function doFormAction (atype,id) {
      	var f=document.getElementById(id);
      	if (f) {
      		if (f.submit) {
      		var inp=document.getElementById(id+'ActionType');
      		var finpts=f.elements;
      		var flag=0;
      		var i=0;
      		for (i=0;i<finpts.length;i++) {
      			var p=finpts[i];
      			if (p.type && p.type=='checkbox' && p.checked) {
      				flag=1;
      				break;
      			}
      		};
      		if (flag) {
      		inp.value=atype;
      		f.submit();
      		} else {
      			alert("Please select one or more clients.");
      		}	
      		}
      	}
      };
    
     </script>
    For some reason, the custom code is canceling out the pngfix and making it so the page either hangs or the images don't load at all. Can anyone see what's happening? I'm calling pngfix like this:

    Code:
    	<!--[if lt IE 7]>
    	<script defer type="text/javascript" src="http://shrink-art.com/docTypes/_scripts/pngfix.js"></script>
    	<![endif]-->
    I just tried removing the custom script altogether and that didn't fix it, so I may be wrong about what's causing the problem with pngfix on this page. The pngfix script is working everywhere else on the site, though, so it's something about this one page - I had assumed the extra JavaScript. The page is here:

    http://shrink-art.com/docTypes/clients/clients.php
    Last edited by tryin_to_learn; Aug 26, 2007 at 07:33. Reason: Adding link


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •