标签:
<script type="text/javascript"> function add_id(){ var dlall=document.getElementsByTagName(‘div‘); for(i=0;i<dlall.length;i++){ dlall[i].id=‘id_‘+i; } } window.onload=add_id; </script> <div>1</div> <div>2</div> <div>3</div> <div>4</div>
标签:
原文地址:http://www.cnblogs.com/wangjiayi/p/5387374.html