Thread Radio Button (18 answers)
Opened by JuHa at 2014-05-22 08:34

GwenDragon
 2014-05-22 11:48
#175621 #175621
User since
2005-01-17
14784 Artikel
Admin1
[Homepage]
user image
Ungetestete Idee, Bilderdaten als Object in ein assoziatives Array.

Als Zugriffschlüssel habe ich hier den Id der Checkbox genommen.
Code (javascript): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/************
// Bild                 : { Objektdaten }
"bild-2" :                {
                                url: 'Bild2.png', 
                                imageSize: [722, 154],
                                projection: proj,
                                imageExtent: proj.getExtent() 
                          }
*************/
                                
var bilder_switched = {
        "bild-switch_2" : {
                url: 'Bild2.png', 
                imageSize: [722, 154],
                projection: proj,
                imageExtent: proj.getExtent() 
                },
        "bild-switch_1" : {
                url: 'Bild1.png', 
                imageSize: [122, 44],
                projection: proj,
                imageExtent: proj.getExtent()
                }       
};


function switchChecked {
        for key in (bilder_switched) {
                if(document.getElementById(key).checked){
                        newL = new ol.layer.Image(bilder_switched[key]);
                        map.removeLayer(baseLayer);
                        map.addLayer(newL);
                }
        }
}

Last edited: 2014-05-22 11:57:26 +0200 (CEST)

View full thread Radio Button