Click here to Skip to main content
15,901,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I just want to change the image source through JavaScript. It works in IE but it didn't work in Firefox and Google Chrome.
Code is written below:
JavaScript
which_image_loaded = 0;
       numberofimages = 14;
       ImageNames = new Object();
       ImageNames.length = numberofimages - 1;
       for (counter = 0; counter < numberofimages; counter++) {
           file_number = counter + 1;
           filename = (".\\books\\\cred\\image" + file_number + ".jpg");
           ImageNames[counter] = filename;
       }


function imgthumb(imgnum) 
{
  document.getElementById("myimage").src = ImageNames[imgnum];
}
Posted
Updated 21-Apr-12 1:25am
v2

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900