0 Replies Latest reply on Apr 18, 2009 8:20 AM by ghouser

    Graphic briefly showing on page load

    ghouser Level 1

      I am using a clickable camera icon image in a page to open a CFWINDOW with a product image in it. The product image source is defined with a variable. When the page loads a table is created with inventory items and to the left should be camera icon, if a product photo is available. I've noticed that when the page initializes that for a brief moment, all of the product imamges are briefly displayed in the table then replaced by the little camera icon. Below is my code.

       

      It this problem due to where I have my code positioned within the CFOUTPUT?

       

       

      <---- snippet ---->

       

      <table border="1" cellpadding="5" bgcolor="ffffff">
      <tr bgcolor="GOLD">
      <td><strong>Item No.</strong></td>
      <td>Photo<br />Avail.</td>
      <td><strong>Class</strong></td>
      <td><strong>Description</strong></td>
      <td><strong>Brand</strong></td>
      <td><strong>Pack</strong></td>
      </tr>
      <cfoutput query="GetInventoryResult">
      <tr>
      <td>
      #ITEM#
      </td>
      <td align="center" valign="middle">
      <cfset ProductPic = #LEFT(ITEM,6)# & ".jpg">
        <cfset PhotoLocation = "C:\coldfusion8\wwwroot\mccinternet\images\productpics\">
      <cfset PhotoLocation = PhotoLocation & #ProductPic#>
      <cfif not FileExists(PhotoLocation)>
       
      <CFELSE>

         <script language="JavaScript">
         init = function(){
            myWindow = ColdFusion.Window.getWindowObject('#productpic#');
            //Add a listener to the "beforehide" event      
            myWindow.on('beforehide',centerWindow);
         }
         centerWindow = function(myWindow){
            //Center the window      
            myWindow.center();
         }
      </script>

      <a href="##" onClick="javascript:ColdFusion.Window.show('#ProductPic#')"><img src="./images/photo.gif" border="0"></a>

      <cfimage action="info" source="#PhotoLocation#" structName="cat">
      <cfset wide = #cat.width# + 50>
      <cfset tall = #cat.height# + 53>

      <cfwindow
      name="#ProductPic#"
        center="true"
              modal="true"
              resizable="true"
              draggable="true"
              height="#tall#"
              width="#wide#"
              bodystyle="background:000000">
             
      <div align="center" style="vertical-align:middle"><img src="./images/productpics/#ProductPic#"></div>

      </cfwindow>

      <cfset ajaxonload("init")>


      </CFIF>
      </td>

      <td>#GetInventoryResult.CLASS#</td>
      <td>#GetInventoryResult.DESCRIP#</td>

      <CFIF #BRAND# EQ "">
      <td> </td>
      <CFELSE>
      <td>#GetInventoryResult.BRAND#</td>
      </CFIF>

      <CFIF #SIZE# EQ "">
      <td> </td>
      <CFELSE>
      <td>#GetInventoryResult.SIZE#</td>
      </CFIF>
      </tr>

      </cfoutput>

      </TABLE>