Question : Changing src in another page

I have an asp page called default.asp which has a javascript file include pointing to faults.js.  Within faults.js is a function which needs to change the src value depending on a variable.  If the image is not available then it should show a default image (pic0.jpg).  The code below works if it is on the asp page which is manipulating however is it possible for it to manipulate the image ("EquipPhoto") on another page such as default.asp?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
//-------------------------------------------------------------------------------------------
//ShowPhoto()
//-------------------------------------------------------------------------------------------
function ShowPhoto(equipid) {
        
    var vara = "/EquipmentPhotos/pic" + equipid + ".jpg";
    document.getElementById('EquipPhoto').setAttribute('src', vara);
    
    $(document).ready(function () {
        $("img").error(function () {
            $(this).attr("src", "/EquipmentPhotos/pic0.jpg");
        });
    });
}

Answer : Changing src in another page

and let the following in faults.js
1:
2:
3:
4:
function ShowPhoto(equipid) {
    var vara = "/EquipmentPhotos/pic" + equipid + ".jpg";
    document.getElementById('EquipPhoto').setAttribute('src', vara);
}
Random Solutions  
 
programming4us programming4us