js更改css样式问题

想把网页中所有的链接的css样式改变
例如

<a href="...." style="font-size:10px;">A</a><a href="...." style="font-size:12px;">B</a><a href="...." style="font-size:14px;">C</a>

HTML内容不能改变变 用js同时将这三个链接的样式改为font-size:20px

求大神支招


守候你守候我
浏览 499回答 1
1回答

DIEA

&nbsp; &nbsp; &nbsp; &nbsp; function turnSize(){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var aTag = document.getElementsByTagName('a');&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(var i in aTag){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aTag[i].style.fontSize = '20px';&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; }
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript