OpenLayers map not showing on my JQuery Mobile site

rcjpia9

New Member
I have an OpenLayers map which is suppose to be made using variables from a PHP array once a button is clicked on my JQuery Mobile site. For some reason however, it is not showing on my page when I click the "show map" button. The box created by the css styles show but it is just empty.Here is my JavaScript:\[code\] var map, baseLayer; var options = {numZoomLevels: 7, isBaseLayer: true,}; function init(rX, rY, rNo) { map = new OpenLayers.Map('map'); baseLayer = new OpenLayers.Layer.Image("Map","map.png", new OpenLayers.Bounds(-1000, -1000, 1000, 1000), new OpenLayers.Size(1500,1500), options); map.addLayer(baseLayer); var center = new OpenLayers.LonLat(rX,rY); map.setCenter(center ,0); map.addControl(new OpenLayers.Control.LayerSwitcher()); map.addControl(new OpenLayers.Control.MousePosition()); var size = new OpenLayers.Size(21,25); var offset = new OpenLayers.Pixel(-(size.w/2), -size.h); var icon = new OpenLayers.Icon('http://www.openlayers.org/dev/img/marker.png',size,offset); var markers = new OpenLayers.Layer.Markers( rNo ); map.addLayer(markers); markers.addMarker(new OpenLayers.Marker(center), icon); }\[/code\]Here is the onlcick function which updates the html for the 'show-on-map' link:\[code\]function updateRoom(rNo, rX, rY){ y=document.getElementById("show-link"); y.innerHTML="<a href='http://stackoverflow.com/questions/15862652/#show-on-map' data-role='button' onclick=init(" + rX + "," + rY + "," + rNo + ")>Show on Map</a>";}\[/code\]I hope this makes sense to anyone reading it!
 
Top