Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

image object problem with netscape

Status
Not open for further replies.

jkalos

IS-IT--Management
Oct 24, 2000
6
US
after loading images into array , the following code works fine with ie to display all images properly

arr_image[1] = new Image();
arr_image[1] = "images/xella.jpg";
arr_height[1] = 402;
arr_width[1] = 383;
arr_image[2] = new Image();
arr_image[2] = "images/bella.jpg";
arr_height[2] = 352;
arr_width[2] = 253;
etc.
...
<img name=&quot;work&quot; src=&quot;null&quot; border=&quot;0&quot;>
...
document.images['work'].src = arr_image[userName];
document.images['work'].width = arr_width[userName];
document.images['work'].height = arr_height[userName];

HOWEVER, netscape 4.7 seems to have a problem by sizing all other images in the array to the first size.(i have not tried a newer version since i am trying to support as many browsers as possible).

thanks
 
I am not sure your code is providing the size for the images when they are pre-loaded, since you are storing the sizes seperately in another array.

try setting the properties instead:
arr_image[0] = new Image();
arr_image[0].src= &quot;images/xella.jpg&quot;;
arr_image[0].width = 383;
arr_image[0].height = 402;


Then when you set them later in in the code, just access these properties like:
document.images['work'].src = arr_image[userName].src;
document.images['work'].width = arr_image[userName].width;
document.images['work'].height = arr_image[userName].height;

I hope this works for you, also remember arrays start at zero, I am not sure if this will have caused problems or not, probably not.

-Ben


&quot;Alright whatever man, I'll hook up the hair, but I aint touchin the ring...Cause I'm still a pla--yer&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top