Coordinates via MouseClick

I have embed a simply osm map in a website with this code:

function init() {
map = new OpenLayers.Map(“basicMap”);
var mapnik = new OpenLayers.Layer.OSM();
map.setCenter(new OpenLayers.LonLat(13.41,52.52) // Center of the map
new OpenLayers.Projection(“EPSG:4326”), // transform from WGS 1984
new OpenLayers.Projection(“EPSG:900913”) // to Spherical Mercator Projection
), 15 // Zoom level

Now I want that when you click on the map you should get the coordinates of this point. I have found this code:

OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
defaultHandlerOptions: {
‘single’: true,
‘double’: false,
‘pixelTolerance’: 0,
‘stopSingle’: false,
‘stopDouble’: false

    initialize: function(options) {
        this.handlerOptions = OpenLayers.Util.extend(
            {}, this.defaultHandlerOptions
            this, arguments
        this.handler = new OpenLayers.Handler.Click(
            this, {
                'click': this.trigger
            }, this.handlerOptions

    trigger: function(e) {
        position =;

alert(“x=”+position.x+“, y=”+position.y);


But when I enter this code, I see only a white screen. What is wrong?
Where do I have to enter this code? And I have heard that I have to change some variables. Which and how do I have to name them?