add a util function to create a random id

git-svn-id: http://svn.openlayers.org/trunk/openlayers@968 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-07-18 16:10:38 +00:00
parent 1a71ac6199
commit 788ee7fee2

View File

@@ -1081,3 +1081,17 @@ OpenLayers.Util.getArgs = function() {
}
return args; // Return the object.
};
/**
* @param {String} prefix String to prefix random id. If null, default
* is "id_"
*
* @returns A unique id string, built on the passed in prefix
* @type String
*/
OpenLayers.Util.CreateID = function(prefix) {
if (prefix == null) {
prefix = "id_";
}
return prefix + Math.round(Math.random() * 10000);
};