dbox print function

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

dbox print function

Sam Young-3
I am trying to add a print function to my dbox application and I don't know
how to get the map image to show up in the new window I am creating.

This is my print function:
<script language="JavaScript">
         function printmap() {
                var w = window.open();
                var d = w.document;
                d.open();
                d.write("<h3>Printable Map</h3>");
                d.write("<img name=\"scalebar_miles\" src=\"" + ms.mapserver + "?map=" +
                config.mapfile
                + "&mode=scalebar&mapext=0+0+" + (ms.extent[2] - ms.extent[0]) + "+" +
(ms.extent[3] - ms.extent[1]) + "&mapsize="
                + ms.width + "+" + ms.height + "\" border=\"0\">");
                d.write("<img id=\"main\" src=\"../graphics/white_pixel.gif\" height=\"" +
mapsizey + "\" width=\"" + mapsizex + "\">");
                d.close();
   }
        </script>

I added this to the tools to access the function:
<a href="javascript:printmap()" >
  <img src="/graphics/print_icon.gif" width="30" height="30" border="0"
alt="print" /></a>

Thanks for the help.

Sam

_________________________________________________________________
View Athlete’s Collections with Live Search
http://sportmaps.live.com/index.html?source=hmemailtaglinenov06&FORM=MGAC01
Reply | Threaded
Open this post in threaded view
|

Re: dbox print function

Steve Lime
Sam: The URL for the current map is held in ms.url, so you should be able to do something
like:

  d.write("<img name=\"the_map\" src=\"" + ms.url + "\">");

Steve

>>> Sam Young <[hidden email]> 12/13/2006 4:22:10 PM >>>
I am trying to add a print function to my dbox application and I don't know
how to get the map image to show up in the new window I am creating.

This is my print function:
<script language="JavaScript">
         function printmap() {
                var w = window.open();
                var d = w.document;
                d.open();
                d.write("<h3>Printable Map</h3>");
                d.write("<img name=\"scalebar_miles\" src=\"" + ms.mapserver + "?map=" +
                config.mapfile
                + "&mode=scalebar&mapext=0+0+" + (ms.extent[2] - ms.extent[0]) + "+" +
(ms.extent[3] - ms.extent[1]) + "&mapsize="
                + ms.width + "+" + ms.height + "\" border=\"0\">");
                d.write("<img id=\"main\" src=\"../graphics/white_pixel.gif\" height=\"" +
mapsizey + "\" width=\"" + mapsizex + "\">");
                d.close();
   }
        </script>

I added this to the tools to access the function:
<a href="javascript:printmap()" >
  <img src="/graphics/print_icon.gif" width="30" height="30" border="0"
alt="print" /></a>

Thanks for the help.

Sam

_________________________________________________________________
View Athlete’s Collections with Live Search
http://sportmaps.live.com/index.html?source=hmemailtaglinenov06&FORM=MGAC01