Newbie and javascript problems

Luis Treviño ltrevinoh at GMAIL.COM
Wed Mar 14 13:13:04 EDT 2007


Ian:

Remember to write the imgxy value (hidden variable on your template) with
the resulting x,y values obtained on your pan function. something like:

function pan(direction) {
   var x, y;
   if(direction == 'n') {
     x = (400-1)/2.0;
     y = 0 - (300 * pansize)/2.0;
....etc
  document.mapserv.imgxy.value = x + " " + y;
  document.mapserv.submit();
}
it should work. Hope it helps

Regards
Luis
2007/3/14, Ian Maxfield <ian.maxfield at aimtc.nhs.uk>:
>
> Hello all,
>
> ms4w installed
> Windows XP (iis uninstalled)
>
> I have been working my way quite happily through the MapServer 4.6tutorial,
> and have been doing fine until I have tried using the examples that
> include
> javascript.   None of the code that includes javascript will work.  E.g.
> when you click on a pan icon to call the javascript function
> pan(direction),
> nothing will happen.  One of the function calls is as follows:
>
> <td align="right" width="18"><a href="javascript:pan('ne')"><img
> src="graphics/nw.png" width="18" height="18" border="0" alt="pan
> northwest"></a></td>
>
> Should call;
>
> function pan(direction) {
>    var x, y;
>    if(direction == 'n') {
>      x = (400-1)/2.0;
>      y = 0 - (300 * pansize)/2.0;
> ....etc
>
> Tests I have tried:
> - created test functions to display alerts
> - changed the href to onclick calls
> - created new function calls elsewhere in the html document
>
> The javascript looks correct in that when you move the cursor onto the
> arrow
> the screen text at the bottom of the screen displays the function e.g.
> javascript:pan('nw'), but then nothing happens on the actual mouse click.
>
> As you can imagine the problem is driving me slightly insane.  Is there
> something obvious that I am missing?  Could it be to do with where the
> ms4w
> folder is stored?
>
> Any help would be greatly appreciated,
>
> Ian
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20070314/7d0615ba/attachment.html


More information about the mapserver-users mailing list