gis_tech

JavaScript Syntax Error

Discussion created by gis_tech on Sep 22, 2011
Latest reply on Sep 22, 2011 by gis_tech
I realize this is a simple problem but it's really got me scratching my head.  The following line of JS code errors out on the function that is bolded:

map.addControl(new HtmlControl('<div id="view"><div style="padding:0px"><div id="viewTitle">View</div></div><div><table style="background-color:White"><tr><td><input type="checkbox" name="green" id="green" onclick="Markers('green')" checked="checked" /></td><td>Green Markers</td></tr><table></div></div>'), new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 42)));


The error I receive is:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)

Message: Expected ')'

Message: Object expected




I've tried all sorts of variations on the onclick="Markers('green')"  syntax but I can't figure out how to pass the "green" parameter to the Markers() function this way. 

I'm sure the answer will be obvious to someone here.  All help would be greatly appreciated!!

Outcomes