[OpenLayers-Users] problem with map.setCenter(....
T at f!t
grob_david at gmx.ch
Mon Mar 22 15:52:45 EDT 2010
Hi,
Thanks for your fast answer. I already tried this. But then, the map didn't
appears. But in FireBug I didn't get an error?!? Propably I did something
wrong because I'm not used using JavaScript.
greetz david
The code is like that:
<html>
<head>
<title>Test</title>
<style type="text/css">
#map{
width:100%;
height:600px;
border:1px solid;
}
</style>
<script
src="http://openlayers.org/api/OpenLayers.js">//http://openlayers.org/api/OpenLayers.js
</script>
<script defer="defer" type="text/javascript">//defer????
function load(){
var wms = new OpenLayers.Layer.WMS(
.
.
.
map.zoomToMaxExtent();
}
function newPos(){
map.setCenter(new OpenLayers.LonLat(145,-40),8);
}
</script>
</head>
<body>
<script type="text/javascript">
var bounds = new OpenLayers.Bounds(
143, -44,
149, -39
);
var options = {
controls: [],
maxExtent: bounds,
maxResolution: 1.200597656250011,
projection: "EPSG:4326",
units: 'm',
};
var map = new OpenLayers.Map('map',options);
load();
</script>
<table width="100%" border="0">
<tr>
<td colspan="2" height="100">blablablaL</td>
</tr>
<tr>
<td width="20%">
<input type="button" value="Go" onClick="newPos()">
</td>
<td>
<div id="map"></div>
</td>
</tr>
</table>
</body>
</html>
--
View this message in context: http://n2.nabble.com/problem-with-map-setCenter-tp4779851p4780021.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list