Does anyone have a suggestion of an efficient way to change borders of all images on a page?
The images are initially added dynamically based on the choices on a previous page, so there is not a fixed number of images to start with, so the quantity of id's will vary.
I would like to be able to select which images will have a border and which will not based on events occurring on the page.
Have this so far:
function pickedpic(pickin)
{
var xxlist = document.getElementsByTagName("img"
for(i=0;i<xxlist.length;i++) {
var xxholdid = document.getElementById(xxlist.id).style.borderWidth = '0px';
}
pickin.style.borderWidth = '3px';
}
I have tried many variations, but can only get the border of the clicked item to change to 3px. Cannot get all other images to return to a border of 0px.
Must have the object logic mixed up somewhere, and would welcome any suggestions, or an easier way to do this.
Thanks!
The images are initially added dynamically based on the choices on a previous page, so there is not a fixed number of images to start with, so the quantity of id's will vary.
I would like to be able to select which images will have a border and which will not based on events occurring on the page.
Have this so far:
function pickedpic(pickin)
{
var xxlist = document.getElementsByTagName("img"
for(i=0;i<xxlist.length;i++) {
var xxholdid = document.getElementById(xxlist.id).style.borderWidth = '0px';
}
pickin.style.borderWidth = '3px';
}
I have tried many variations, but can only get the border of the clicked item to change to 3px. Cannot get all other images to return to a border of 0px.
Must have the object logic mixed up somewhere, and would welcome any suggestions, or an easier way to do this.
Thanks!