Displaying an image dynamically

Results 1 to 2 of 2

Thread: Displaying an image dynamically

  1. #1
    Rob Reid Guest

    Default Displaying an image dynamically

    I am trying to dynamically show an image on my web site. Depending on a variable, the system looks up the relevant image file in an array and then displays it on the page. At the moment though the page just shows a white box with a red cross -"sorry no image" kind of thing. The images exist. If I just do a document write instead of an image tag it correctly gets the right file name out of the array. Why is it not showing??? Here is my code. <BR>All the js files are located in the top frame. The image is being set in the body.<BR><BR>This is how I try to display the image from the HTML.<BR>&#060;IMG ID="Picture10" HEIGHT=50 WIDTH=93 SRC="javascript:top.getProductDetails(top._product , 3)" BORDER=0 &#062;<BR><BR>var _product = "Classic"; //Card Product type<BR><BR>outlet0 = new Array("Classic","17.9%", "£100,000","file:///c:/Babel/Images/HalifaxClassic.JPG");<BR>outlet1 = new Array("Gold","16.9%", "£250,000", "file:///c:/Babel/Images/HalifaxGold.JPG");<BR> <BR>Retail = new Array("",outlet0, outlet1);<BR><BR><BR>function getProductDetails(product, part){<BR> <BR> var find = product <BR> <BR> for(var x=1;x&#060;=2;x++){<BR> for(var y=0; y&#060;=3;y++){<BR> if(Retail[x][y]==find){<BR> var Result = Retail[x][part]; <BR> //alert("Outlet Name is " + Retail[x][part] + " " + OutletName); <BR> }<BR> } <BR> }<BR> <BR> return Result; <BR> <BR> }

  2. #2
    Join Date
    Dec 1969

    Default RE: Displaying an image dynamically

    you can&#039;t use a javascript: url in an SRC="" attribute.<BR><BR>try using javascript to document.write() the ENTIRE image tag.<BR><BR>j

Posting Permissions

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