If I follow you correctly, you need to assign some id dynamically to a div already created.
Whenever you declare a div without id, it will not be identified directly through id.
Well that doesn't mean, that javascript cannot identify it.
You can getallelements and iterate to get the div object.
But the problem is, there can be multiple div without id. So, though you can get the div object you cannot identify which one is which.
I presume, you use attribute to cater you requirements.
Or when you generate the aspx page, create the html on fy and set it in div object. Thus you can know the id while generating the html.
Here is a solution to assign id to div using jquery,
var idCount = 1;
$('div').each(function() {
$(this).attr('id', 'div_' + idCount);
idCount++;
});
Another solution in javascript,
You need to give an id to identify div;
var element = document.getElementById('div1');
element.setAttribute('id', 'div1');
Hope this helps.
cheers