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:
@@ -1081,3 +1081,17 @@ OpenLayers.Util.getArgs = function() {
|
|||||||
}
|
}
|
||||||
return args; // Return the object.
|
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);
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user