PHP: javascript:var divs=document.getElementsByTagName('div');for(var i=0;i<divs.length;i++){var matches=divs[i].id.match('^res([\\d]+)$');if(matches!=null&&matches.length>0){acceptFriend(parseInt(matches[1]));}}