<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<script type="text/javascript">
function next_id(){
var current_id = 0
return function (){
return ++current_id
}
}
var g = next_id()
for( let i = 0i <10i++ ){
console.log(g())
}
</script>
<body>
</body>
</html>
var ele = document.getElementById('id_name')ele.id = 'id_name'
ele.setAttribute('name', 'name_value')