Bueno, ya lo he conseguido. Estaba considerando las palabras red, yellow y green como variables en mi if. Menudo fallo!
Este es el código. Permite cargar tres ficheros que le indiquemos y verlos o no según seleccionamos. Es decir como si fuesen capas.
Polifemo, te agradezco mucho la ayuda que me has prestado. Llevaba tiempo detrás de esto y anda que no he dado palos de ciego hasta ahora!!
Un saludo
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="CHARSET" CONTENT="ISO-8859-1">
<title>Capas en Google Earth</title>
<!--SUSTITUYE POR TU KEY API-->
<script src="http://www.google.com/jsapi?key=ABQIAAAArCZgeQ8ddm8YbeJQqqHN5BTYrZjdppbykE52CdH9dtH9wJ0VsBQSgm6ZbaTJsaMARyyYkz_JttmHMQ"></script>
<script type="text/javascript">
function addSampleButton(caption, clickHandler) {
var btn = document.createElement('input');
btn.type = 'button';
btn.value = caption;
if (btn.attachEvent)
btn.attachEvent('onclick', clickHandler);
else
btn.addEventListener('click', clickHandler...
Leer más ...