i am trying to write a function so that when a user enters onto a page selected images change with each page that is entered. the page uses an iframe to load the new data so i need to swap the images on the main page which holds the iframe inside it.

function swap_image{
    document['imgMain'].src = title_commissioning.jpg;

in the body of the page


would the code look something like the code above or would it need to be expanded because the images that are being change are not in the iframe.

i ahve changed the code but it still is not working the code i have now looks like this

function changeImage() {
if (document.getElementById) {
else if (document.all) {
else if (document.layers) {

in the body tag


and were the image is displayed

<td height="24"  colspan="2" id="image" background="images/commissioning_title.jpg"></td>

i will kep looking for the solution if i find it i will post it. if anyone knows were to find the solution please post the address here.

still cannot get any code to work anyone know of any way to get the images to swap when the page is loaded. everything i have tried has failed up to i will keep trying though.

i ended up getting it work using iframes, i no it is not the same but it works.

i set the i frames to load different images in from a button click in the menu. it works fine and has no effect on the page loading times.

This question has already been answered. Start a new discussion instead.