i have two divs with the same ids but one has di开发者_如何学JAVAsplay=none and the other has display=block i want to delete the one with display='none' i am using javascript framework prototype
You cannot have two controls with the same ID, it is invalid. You should rewrite your code so the IDs are not the same.
You should switch to giving the divs classes instead of id's. ID's are unique identifiers, thus are unique, and a page should only contain one element per id (an id can not have multiple elements).
If you'd gave the divs classes instead of id's you could do this:
$$(".<your_class_here>").reject(Element.visible).each(Element.remove);
My Prototype is a bit rusty, but I think this should do it.
EDIT: forgot you can't directly filter by CSS properties.
You shouldn't have two elements with the same ID. You should use classes.
精彩评论