JS循环网页元素,手动触发事件

for (i=0;i<document.all.tags("input").length;i++)
                {
                    
if(document.all.tags("input")[i].type == "checkbox")
                    {
                        
if(selected  && !document.all.tags("input")[i].checked  )
                            document.all.tags(
"input")[i].click();
                        
else if(!selected  && document.all.tags("input")[i].checked  )
                            document.all.tags(
"input")[i].click();

                    }
                    }
通过document.all.tags对HTML元素进行选择,这样就可以通过循环遍历到所有自己想找的元素,
posted on 2004-09-02 13:42  edobnet  阅读(2421)  评论(4编辑  收藏  举报