如何用js获取div下的A标签,并改变A标签的ID。
<DIVid=discuz_23007105_002SLOTauto_gen_3style="DISPLAY:block;OVERFLOW:hidden;WIDTH:72...
<DIV id=discuz_23007105_002SLOTauto_gen_3 style="DISPLAY: block; OVERFLOW: hidden; WIDTH: 728px; POSITION: relative; HEIGHT: 90px" oid="1627042617" display="banner"><A href="http://caclick.soso.com/click?aid=pdsjKiJFaLdlUMZq7ePlx-EHN_mkjHvcBICSmiyQfkXFP9I0zPBeHOKbomrSF3-9oL-Q5brUzUq7eWNXax-Qo3lYVw4iKXWH2_Xk-Rpk3uqb-yn8kj4mPxgXHWSxNAbrJPWX6vNXqfW5XI53oyCaRBb8YWk_o82Vm_HwxBby7KWAvtbrQ4mwQlJJ5cT6QPrP6yWc3qtIyUpKCoDkJh5KMq_TODmSqj9MjuYwz5x0w25VBtOm8PJResvKqSp950LWhcb477OQYeJhPcKUHjzhFCZ6YKKJ37AD8wmfWYvWZ9LtA5ojAhbHRa9FKNEBNyVeRtEAs4_JflWBEJkz9J9gyh5J9s_6a3F3pa3UbbN5EqMYRgw3qy-6GijvRZSK8BsCoLHjtiYwHMP5ZTOzcYC65P29-eDq73U-Ku0sGKSa7PZIua0lqsEidbBGMiy7tIiBmwu4IH1GY8La8Yr3d9SDrYdeEMCopfAsqYaubEGWETfVshXVsYMIkxCkSVyd7Bwx" target=_blank></A><A class="absolute a_cover" href="http://caclick.soso.com/click?aid=pdsjKiJFaLdlUMZq7ePlx-EHN_mkjHvcBICSmiyQfkXFP9I0zPBeHOKbomrSF3-9oL-Q5brUzUq7eWNXax-Qo3lYVw4iKXWH2_Xk-Rpk3uqb-yn8kj4mPxgXHWSxNAbrJPWX6vNXqfW5XI53oyCaRBb8YWk_o82Vm_HwxBby7KWAvtbrQ4mwQlJJ5cT6QPrP6yWc3qtIyUpKCoDkJh5KMq_TODmSqj9MjuYwz5x0w25VBtOm8PJResvKqSp950LWhcb477OQYeJhPcKUHjzhFCZ6YKKJ37AD8wmfWYvWZ9LtA5ojAhbHRa9FKNEBNyVeRtEAs4_JflWBEJkz9J9gyh5J9s_6a3F3pa3UbbN5EqMYRgw3qy-6GijvRZSK8BsCoLHjtiYwHMP5ZTOzcYC65P29-eDq73U-Ku0sGKSa7PZIua0lqsEidbBGMiy7tIiBmwu4IH1GY8La8Yr3d9SDrYdeEMCopfAsqYaubEGWETfVshXVsYMIkxCkSVyd7Bwx&k=%E8%83%83%E9%A3%9F%E9%81%93%E5%8F%8D%E6%B5%81%E7%97%87%2C%E8%83%83%E9%A3%9F%E9%81%93%E5%8F%8D%E6%B5%81%E6%B2%BB%E7%96%97%E6%96%B9%E6%B3%95&t=%E8%83%83%E9%A3%9F%E9%81%93%E5%8F%8D%E6%B5%81%E7%97%87%E7%9A%84%E6%B2%BB%E7%96%97%E6%96%B9%E6%B3%95%E6%8B%92%E7%BB%9D%E5%88%BA%E6%BF%80%E6%80%A7%E7%AD%89%E9%A3%9F%E7%89%A9_&r=&s=" target=_blank rel=nofollow></A><A class="absolute a_cover" style="Z-INDEX: 11; RIGHT: 0px; FILTER: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=''); WIDTH: 0px; BOTTOM: 0px; POSITION: absolute; HEIGHT: 0px" href="" target=_blank></A></DIV>
展开
推荐于2016-01-05 · 知道合伙人软件行家
百度网友ad45923b8
知道合伙人软件行家
向TA提问 私信TA
知道合伙人软件行家
采纳数:262
获赞数:386
从事IT互联网行业16年,经验丰富,擅长ASP、HTML、Javascript,Css,JQuery,PHP,PS,FL,AI,E,服务器等
向TA提问 私信TA
关注
展开全部
建议你使用jQuery,这样方便简洁一些
如:
$(function(){
$("div a").attr("id","新id");
})
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
var _a=document.getElementById("test").getElementsByTagName("a");
_a.item(0).setAttribute("id","yourstylename1");
_a.item(1).setAttribute("id","yourstylename2");
_a.item(0).setAttribute("id","yourstylename1");
_a.item(1).setAttribute("id","yourstylename2");
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询