[mapserver-users] Is there a way to add a single click zoom button

Pietro Giannini pgiannini at bytewise.it
Tue Jan 20 05:36:13 EST 2009


Your code seems correct...

maybe a javascript error.
If you use firefox you can intercept javascript errors with the error
console.

my code, simplified, is:

<html>
<head>
<script language="JavaScript">
	function zoom2x()
	{
		document.forms['mapserv'].imgxy.value =
			[mapwidth]/2 + " " + [mapheight]/2;
		document.forms['mapserv'].zoom.value = 2;
		document.forms['mapserv'].submit();
	}
</script>
</head>
<body>
<form name="mapserv" method=GET action="/cgi-bin/mapserv.exe">
<!-- the map path, mandatory -->
<input type="hidden" name="map" value="[map]">
<!--  the center of the img, no matter to valorize with the [center] cgi
variable  -->
<input type="hidden" name="imgxy">
<!-- the current extent of the map, mandatory -->
<input type="hidden" name="imgext" value="[mapext]">
<!-- the zoom -->
<input type="hidden" name="zoom">
<!-- the map image -->
<input type="image" name="img" src="[img]" width="[mapwidth]"
height="[mapheight]" alt="map"">
<!-- the button -->
<input type="button" value="zoom in 2 X" onclick="javascript:zoom2x();">
</form>
</body>
</html>

this work, try it.

ciao ...........pg

-- 
Pietro Giannini
Bytewise srl - Area GIS
41°50'38.58"N 12°29'13.39"E



On Lun, Gennaio 19, 2009 22:30, boesiii wrote:
>
> PG
>
>
> I added the script and the button control but I am not sure about the
> third
> item you mentioned.  I added the lines "<input type="hidden" name="imgxy"
> value="[center]" />
> <input type="hidden" name="zoom" value="2" />" in the mapserver variables
> section but when I click the button nothing happens?
>
> What is the problem?
>
>
>



More information about the mapserver-users mailing list