[Mapserver-users] retain button state

Jason M. Nielsen jnielsen at aero-graphics.com
Wed Feb 4 10:26:40 EST 2004


Quoting Steve McCrone <ms57 at streamyx.com>:

> I am using jBox and I wish to retain which button was enabled after form
> submit. As you can see from below I have placed some GIFs on my page and
> then use some javascript functions to produce the effect of a typical GIS
> applciation where one tool is enabled.
> 
> However, when the user zooms in and the form gets submitted, then I wish to
> keep the zoomin tool enabled (i.e.place the /graphics/ZoomInDown.gif) and
> enable the zoomin functionality, as done in the cse statement. This is more
> of a pure javascript issue, but since I'm no expert in js, thought i would
> ask to see if anyone can piece together my caode to make it work.
> 
> Thanks,
> 
> Steve
> 
> file://demo.html
> <a href="" onclick="return false" onmousedown="clearimg();"
> onmouseup="on('image1');"><img src="/graphics/ZoomInUp.gif" border="0"
> alt="Zoom In" name="image1" width="23" height="20"></a>
> <a href="" onclick="return false" onmousedown="clearimg();"
> onmouseup="on('image2');"><img src="/graphics/ZoomOutUp.gif" border="0"
> alt="Zoom Out" name="image2" width="23" height="20"></a>
> 
> 
> file://toolbar.js
> var NN3 = false;
> file://==tools===
> image1 = new Image();
> image1.src = "/graphics/ZoomInUp.gif";
> image1on = new Image();
> image1on.src = "/graphics/ZoomInDown.gif";
> 
> image2 = new Image();
> image2.src = "/graphics/ZoomOutUp.gif";
> image2on = new Image();
> image2on.src = "/graphics/ZoomOutDown.gif";
> 
> function on3(name)   {
>  document[name].src = eval(name + "on.src");
>  }
> 
> function clearimg(){
>  document.image1.src = image1.src
>  document.image2.src = image2.src
>  }
> 
> 
> NN3 = true;
> function on(name)  {
>  if (NN3) on3(name);
>  switch(name){
>   case "image1"://Zoom In
>    document.mapserv.mode.value = "browse";
>    document.mapserv.zoomdir.value = 1;
>    document.jBox.boxon();
>    break;
>   case "image2"://Zoom Out
>    document.mapserv.mode.value = "browse";
>    document.mapserv.zoomdir.value = -1;
>    document.jBox.boxoff();
>    break;
>  }
> }

Can you pass the states to the page?  ie: Pass mode=map activebutton=zoomin  etc.

Or perhaps use DIV tags, display your map within them and only update their
source. This is what is done in the "workshop" tutorial/example using dbox.

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/



More information about the mapserver-users mailing list