a list of images that have delete boxes next to them and then a delete button at the bottom.Once you click the delete button it figures out what boxes you have checked and then sends an Ajax call delete the records. Once that is done another Ajax call is fired to repopulate the div with the remaining images.
Say i check the first 2 images then hit delete. The images are deleted and the div repopulates with the remaining images. If i then decide I want to delete one more i click on that check box and hit delete. In IE it will delete the checked image and i am happy. In firefox it uses the old form id numbers of the images that i already deleted and if the second time i chose only one image it still sends the 2 old image id numbers. It is like frefox is not bothering to run the javascript again to get the values and figures it knows it.
Below is me code. Thanks for your help.
Expand|Select|Wrap|Line Numbers
- function deleteimgs(ListingID){
- var del_idadditonal_images = '';
- for (i=0; i<imageform.del_idadditonal_images.length; i++) {
- if (imageform.del_idadditonal_images[i].checked) {
- if (del_idadditonal_images != ''){
- del_idadditonal_images = del_idadditonal_images + ",";
- }
- del_idadditonal_images = del_idadditonal_images + imageform.del_idadditonal_images[i].value;
- }
- }
- if (del_idadditonal_images == ''){
- alert('You must select at least one image to delete.');
- return false;
- }
- if (confirm('Are you sure you would like to delete the selected images?')){
- var url="../ajax/image_functions.asp";
- url=url+"?action=deleteimg";
- url=url+"&idadditonal_images="+del_idadditonal_images;
- new Ajax(url, {
- method: 'get',
- onComplete: function(){
- del_idadditonal_images = null;
- reloadimages(ListingID);
- }
- }).request();
- }
- }