I am setting up checkboxes that i would like to enable/disable layers i have on a google earth project using Dojo. I understand how to create the checkboxes, and select and deselect them. But how do i use these values, to pass a particular function. For instance, i have a function that i can run in a script, that will turn on borders on Google Earth, if it is marked true. I would like to have it set so that if a box is checked, it will be on, otherwise, uncheck it to turn off the borders. Here is the command to turn them on:
ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true)
Here is the code i am currently using for showing the checkbox in the body of the page:
开发者_开发技巧<input id="BorderCheck" name="BorderCheck" dojoType="dijit.form.CheckBox" value="On" checked /><label for="Borders">Turn Borders on/off"</label>
Here's a quick and dirty suggestion, try:
<input id="BorderCheck"
name="BorderCheck"
dojoType="dijit.form.CheckBox"
value="On" checked
onChange="ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, arguments[0]);"
/>
<label for="Borders">Turn Borders on/off</label>
Assuming that ge
is a global variable, of course.
精彩评论