js如何修改a标签的href属性值!!

JavaScript08

js如何修改a标签的href属性值!!,第1张

先加个id:<a id='link' href="/index.html" target="_parent">

js:

var link=document.getElementByidId('link').getAttribute('href')//就是你想要的了

使用a标签也就是使用下样式而已

既然是跳转

将a标签写成 <a href="javascript:void(0)" onclick="fun_a()" ></a>

然后fun_a写跳转事件 location.href=""