<div dir="ltr">In the lines like:<div><br></div><div> if (overl == pm09) {<br></div><div><br></div><div>the values need to be in quotes:</div><div><br></div><div> if (overl == "pm09") {<br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, May 27, 2014 at 9:59 AM, Todd Fagin <span dir="ltr"><<a href="mailto:tfagin@coordinatesolutions.com" target="_blank">tfagin@coordinatesolutions.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks to Robert for this excellent suggestion. Nonetheless, I am still<br>
having problems getting this to work. For the life of me, I cannot figure<br>
out what I am doing wrong.<br>
<br>
Here is a sample of what I am trying to do:<br>
<a href="http://biosurvey.ou.edu/purple_martin/Simplified_Dropwdown_to_Share.html" target="_blank">http://biosurvey.ou.edu/purple_martin/Simplified_Dropwdown_to_Share.html</a><br>
<br>
If anyone would kindly look at the code and point out where I have gone<br>
astray, it would be greatly appreciated.<br>
<div class="im HOEnZb"><br>
Many thanks in advance,<br>
<br>
Todd<br>
<br>
Todd Fagin<br>
<br>
Coordinate Solutions, Inc.<br>
2804 NW 18th St.<br>
Oklahoma City, OK 73107<br>
<a href="tel:405.740.4324" value="+14057404324">405.740.4324</a><br>
<a href="http://www.coordinatesolutions.com" target="_blank">www.coordinatesolutions.com</a><br>
<br>
</div><div class="HOEnZb"><div class="h5">-----Original Message-----<br>
From: Robert Sanson [mailto:<a href="mailto:Robert.Sanson@asurequality.com">Robert.Sanson@asurequality.com</a>]<br>
Sent: Sunday, May 25, 2014 4:51 PM<br>
To: Todd Fagin; <a href="mailto:openlayers-users@lists.osgeo.org">openlayers-users@lists.osgeo.org</a><br>
Subject: Re: [OpenLayers-Users] Combo Box for layers<br>
<br>
Hi Todd<br>
<br>
Suppose you have some HTML for the combo box:<br>
<br>
 <p><select name="Layer" id="layer"><br>
    <option value="layer1">Layer 1</option><br>
    <option value="layer2">Layer 2</option><br>
    <option value="layer3">Layer 3</option><br>
  </select><br>
<br>
Then you have a Javascript function:<br>
<br>
function showoverlay() {<br>
  var overl = document.getElementById('layer').value;<br>
  if overl == layer1 {<br>
    l1.setVisibility(true);<br>
    l2.setVisibility(false);<br>
    l3.setVisibility(false);<br>
  }<br>
  else if overl == layer2 {<br>
    l1.setVisibility(false);<br>
    l2.setVisibility(true);<br>
    l3.setVisibility(false);<br>
  }<br>
  else if overl == layer3 {<br>
    l1.setVisibility(false);<br>
    l2.setVisibility(false);<br>
    l3.setVisibility(true);<br>
  }<br>
}<br>
<br>
where l1, l2, l3 are the overlay layers that have been added to the map.<br>
<br>
Regards,<br>
<br>
Robert<br>
<br>
<br>
>>> Todd Fagin <<a href="mailto:tfagin@coordinatesolutions.com">tfagin@coordinatesolutions.com</a>> 23/05/2014 7:41 a.m. >>><br>
Greetings OpenLayer users,<br>
<br>
<br>
<br>
I have what I assume is a fairly simple question, one that has likely been<br>
addressed previously. However, I have been unable to find the solution<br>
online. To add insult to injury, I am not a programmer. I can look at<br>
existing code and often modify it to my needs, but if I start with a blank<br>
slate, I usually end with a blank slate.<br>
<br>
<br>
<br>
So, here is my problem in a nutshell:<br>
<br>
<br>
<br>
I have a simple OpenLayers application that displays WMS layers from<br>
GeoServer plus several base layers (Google, Bing, etc.). Currently, it is<br>
configured with the standard LayerSwitcher. However, I would like to have a<br>
combo box from which users can select the overlay to display. It would be<br>
nice to have a default overlay set, then users could select from the<br>
dropdown list which overlay to display (for my purpose at hand, it is not<br>
necessary to display more than one overlay at a time-at least the overlays I<br>
wish to include in the combo box).<br>
<br>
<br>
<br>
Surely (I assume), this is something many individuals have done before.<br>
<br>
<br>
<br>
Keep in mind what I said above: I am not a programmer. So, if someone has<br>
some sample code I could cannibalize, I will be forever in your debt (well,<br>
maybe not forever, but.)<br>
<br>
<br>
<br>
Many thanks in advance,<br>
<br>
<br>
<br>
Todd<br>
<br>
<br>
<br>
Todd Fagin<br>
<br>
<br>
<br>
Coordinate Solutions, Inc.<br>
<br>
2804 NW 18th St.<br>
<br>
Oklahoma City, OK 73107<br>
<br>
<a href="tel:405.740.4324" value="+14057404324">405.740.4324</a><br>
<br>
<a href="http://www.coordinatesolutions.com" target="_blank">www.coordinatesolutions.com</a><br>
<br>
<br>
<br>
<br>
<br>
<br>
This email and any attachments are confidential and intended solely for the<br>
addressee(s). If you are not the intended recipient, please notify us<br>
immediately and then delete this email from your system.<br>
<br>
This message has been scanned for Malware and Viruses by Websense Hosted<br>
Security.<br>
<a href="http://www.websense.com" target="_blank">www.websense.com</a><br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
</div></div></blockquote></div><br></div>