[Mapserver-users] pan/javascript

BONNER S KARGER bskarger@students.wisc.edu
Tue, 20 Apr 2004 08:53:49 -0500


I had a similar problem, and Steve pointed me to look at the name of the main form that draws the map. In the example, it is called "mapserv" (hence the document.mapserv.zoom in the end of the script). If your form is not named "mapserv", it won't work. 

something like this should work:

<form method="GET" name="mapserv" action="[program]">

Or if you don't want to change the form name to "mapserv", change the javascript to reflect the name of your form.

Good luck,
>>Bonner



----- Original Message -----
From: Kaps Stefan <0098kast@edu.fh-kaernten.ac.at>
Date: Monday, April 19, 2004 5:58 pm
Subject: [Mapserver-users] pan/javascript

> hello,
> i wanted to create a pan control as it is described in the 
> tutorial. so i did the javascript part and the part with the arrows.
> 
> <script language="javascript">
>  var pansize = 0.80;
>  function pan(direction) {
>    var x, y;
>    if(direction == 'n') {
>       x = ([mapwidth]-1)/2.0;
>       y = 0 - [mapheight]*pansize + [mapheight]/2.0;
>     } else if(direction == 'nw') {
>       x = 0 - [mapwidth]*pansize + [mapwidth]/2.0;
>       y = 0 - [mapheight]*pansize + [mapheight]/2.0;
>     } else if(direction == 'ne') {
>       x = ([mapwidth]-1) + [mapwidth]*pansize - [mapwidth]/2.0;
>       y = 0 - [mapheight]*pansize + [mapheight]/2.0;
>     } else if(direction == 's') {
>       x = ([mapwidth]-1)/2.0;
>       y = ([mapheight]-1) + [mapheight]*pansize - [mapheight]/2.0;
>     } else if(direction == 'sw') {
>       x = 0 - [mapwidth]*pansize + [mapwidth]/2.0;
>       y = ([mapheight]-1) + [mapheight]*pansize - [mapheight]/2.0;
>     } else if(direction == 'se') {
>       x = ([mapwidth]-1) + [mapwidth]*pansize - [mapwidth]/2.0;
>       y = ([mapheight]-1) + [mapheight]*pansize - [mapheight]/2.0;
>     } else if(direction == 'e') {
>       x = ([mapwidth]-1) + [mapwidth]*pansize - [mapwidth]/2.0;
>       y = ([mapheight]-1)/2.0;
>     } else if(direction == 'w') {
>       x = 0 - [mapwidth]*pansize + [mapwidth]/2.0;
>       y = ([mapheight]-1)/2.0;
>     }
> 
>    document.mapserv.zoom[0].selected = true;
>    document.mapserv.imgxy.value = x + " " + y;
>    document.mapserv.submit();
>  }
> </script>
> ...
> <td>align="right" bordercolor="#ECE9D8" bgcolor="#666666"><img 
> src="/graphics/nw.gif" width="18" height="18" border="0" alt="pan 
> northwest"></td>...
> 
> thats all i did but it doesn't work... does anybody know what i've 
> done wrong or what i have forgotten?!
> 
> cheers,
> Stefan
> 
> 
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users@lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> 

_______________________________________________
Mapserver-users mailing list
Mapserver-users@lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users