OpenLayers: Popup message on map click

I’d like to popup a message when a user clicks anywhere on the map. Unfortunately any sample code I found depends on either a marker or a polygon etc. Does anybody have code which just shows how to use the popup control with a simple single click? So far I’ve successful used sample “click.html” yet instead of a alert I’d like to popup a message box.

Wyo

Have a look at www.bestofosm.org (JS without “minimized” Filename). It shows you how to add a so called ‘feature’ that is a represantation on the vector layer. I guess this is what you want?

Not quite. Your sample depends on certain features outlined on the map, you can only click a feature. Mine allows to click anywhere on the map (http://www.orpatec.ch/osm/tools/main.php) yet then I have no feature I can link the popup with. I tried

  trigger: function(evt) {
    var lonlat = map.getLonLatFromViewPortPx (evt.xy).transform (projMercator, projLonLat);
    alert ("You clicked near " + lonlat.lat + " N, " + lonlat.lon + " E");
    feature = evt.feature;
    popup = new OpenLayers.Popup.FramedCloud ("info", lonlat, null,
              "<h2>"+ "Test" + "</h2>", null, true, onPopupClose);
    feature.popup = popup;
    popup.feature = feature;
    map.addPopup (popup);
  }

I guess the “feature = evt.feature;” is wrong but I don’t know how to fix it.

Wyo