I'm still not seeing/understanding this. DIV elements do not have a "URL" attribute, so your example doesn't make sense to me.
Ignoring all of that, can we "abstract" your question this way:
How do I change the attribute of an element, based on a variable passed into a function?
My answer would be, assuming you have a variable "getid" that corresponds to the ID of the element you wish to modify: document.getElementById(getid).attributeName = "attributeValue";
If that doesn't work, you can try the DOM method "setAttribute()".