<html>
<head>
<title>test</title>
</head>
<body>
<div id="id1">testdiv</div>
<a herf="#" onclick="document.getElementById('id1').id = 'id2';">ändere ID</a><br>
<a herf="#" onclick="alert(document.getElementsByTagName('div')[0].id);">zeige ID</a><br>
</body>
</html>
funktioniert bestens
Gruß
C2H5OH