Hello everyone,
I am trying to pass a object in to the function as a parameter and i am getting following error in javascript
missing ] after element list…
the application handle the object but when it generate the script for method
[code]
“<a href=”javascript:mapManager.ZoomToGeoFence(“+[COLOR=”Red”]obj[/COLOR]+”)”>”+obj.Name + “</a>”
it replace the parameter to “[object Object]”
I have pasted a sample code for your reference
[code]
function GetGeoFencesAsList()
{
var result=”;
device = loadDevice(’12’)
if(device.GeoFences.GeoFenceList.length==0)
result = ‘No GeoFences Set’;
else{
for(fence in device.GeoFences.GeoFenceList){
var obj = new geoFence(device.GeoFences.GeoFenceList[fence]);
alert(obj.GetXml);
[COLOR=”DarkGreen”] result+= “<a href=”javascript:mapManager.ZoomToGeoFence(“+[COLOR=”Red”]obj[/COLOR]+”)”>”+obj.Name + “</a>, “;[/COLOR]
}
//trim the last comma for neatness
result = result.slice(0,result.length-2);
}
return result;
}
MapManager.prototype.ZoomToGeoFence= function(geofence)
{
alert(geofence.Name);
}
function geoFence(obj)
{
this.CommandStatus = obj.CommandStatus;
this.Continous = obj.Continous;
this.DeviceID = obj.DeviceID;
this.Enabled = obj.Enabled;
this.Entry = obj.Entry;
this.Exit = obj.Exit;
this.GeoFenceAlert = obj.GeoGenceAlert;
this.GetXml = obj.GetXml;
this.ID = obj.ID;
this.Latitude1= obj.Latitude1;
this.Latitude2 = obj.Latitude2;
this.Longitude1= obj.Longitude1;
this.Longitude2 = obj.Longitude2;
this.Name = obj.Name;
this.Number = obj.Number;
this.Shape = obj.Shape;
}
thanks
Ameet