<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>
时间: 2024-10-19 04:21:47