Hello!

I want to set some additional values to to a marker
that I can use it if a marker is pressed.

The idea was this:

====================================================
[...]
var icon = new OpenLayers.Icon(contentPath + 
'/img/Map_Pin_by_Merlin2525_small_yellow.png', new OpenLayers.Size(40,47),
new OpenLayers.Pixel(-3,-45)); var marker = new OpenLayers.Marker(lonLatMarker, 
icon);
    marker.feature = feature;

        //SET THE NEW VALUE
    marker.NEWVALUE = my_new_value;                             <--- HERE

    var markerClick = function(evt) {
        
        //GET THE VALUE IF THE MARKER IS PRESSED
        alert('This marker has value' + this.NEWVALUE);         <--- AND THERE
        if (this.popup == null) {
            this.popup = this.createPopup(this.closeBox);
            map.addPopup(this.popup);
            this.popup.show();
        } else {
            this.popup.toggle();
        }


=======================================================

I thought, this works like "adding a value to an object in javascript like in 
common",
but if I use the code like this, the "this.NEWVALUE" is "undefined"

Why I need it: (maybe someone has another idea to realize this)
* user clicks on marker
* the "value" of the marker whould then put into a hidden field
* user press "remove" button to request to server to remove this marker
  also maybe an ajax call will send with the id, but I need something to 
identify the marker

first I used lon,lat to identify, but that is not that clean coding, because 
maybe there are more then one pointer on
this place and so on.

eichi

 

-- 
-
Mein Weblog: http://der-eichi.de
Themen unter anderem aus den Bereichen |Politik|, |Linux| und |freie Software|
-----
Mein öffentlicher PGP Schlüssel: http://pgp.der-eichi.de
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to