This code works perfectly in Firefox bu gives errors deselecting in IE 8. Why does this code give a property not supported error on line 10 char 3?
Which works this HTML:Code:var selected = Array(); function $(id) { return document.getElementById(id); } function imgSelect() { if (this.className == "selected") { //Error line below selected.splice(selected.indexOf(this.id), 1); document.modify.to_delete.value = selected.join("|"); this.className = null; } else { selected[selected.length] = this.id; document.modify.to_delete.value = selected.join("|"); this.className = "selected"; } } var imgs = $("image_box").getElementsByTagName("img"); for (x in imgs) { imgs[x].onclick = imgSelect; }
HTML Code:<input type="hidden" name="to_delete" value="" /> <div id="image_box"> <img src="/images/Test Item 22/thumbnails/Desert.jpg" alt="Desert.jpg" title="Delete?" id="Desert.jpg" /> <img src="/images/Test Item 22/thumbnails/I Love You.png" alt="I Love You.png" title="Delete?" id="I Love You.png" /> <img src="/images/Test Item 22/thumbnails/Jellyfish.jpg" alt="Jellyfish.jpg" title="Delete?" id="Jellyfish.jpg" /> <img src="/images/Test Item 22/thumbnails/Lighthouse.jpg" alt="Lighthouse.jpg" title="Delete?" id="Lighthouse.jpg" /> <img src="/images/Test Item 22/thumbnails/Penguins.jpg" alt="Penguins.jpg" title="Delete?" id="Penguins.jpg" /> <img src="/images/Test Item 22/thumbnails/Tulips.jpg" alt="Tulips.jpg" title="Delete?" id="Tulips.jpg" /> </div>


LinkBack URL
About LinkBacks

Reply With Quote


