<html>
<head>
</head>
<body>
I actually had to play with it a while to get it working also. As you can
see the comment line right above that line where I'm setting the zoomdir
says that we must "select the Pan option", but a zoomdir value of "1" is
really zoom in. Selecting Pan didn't work in my web page, so I started manually
setting the zoomdir value to 1 (zoom in) and it worked.<br>
<br>
Couple of notes here. You will probably be able to nail down exactly what
your problem is by watching the "Javascript Console" that comes with your
web browser. Under Netscape I find this console by pulling down the "Tasks"
menu in my browser and going to the "Tools" option and then selecting "Javascript
Console". I see exactly which line of my code is crapping out by watching
the errors that appear on that console when I load my page.<br>
<br>
Also, I went ahead and put a couple of lines into my init HTML page to manually
set the initial values of a couple of variables...like this:<br>
<br>
<input type="hidden" name="zoomsize" value=2><br>
<input type="hidden" name="zoomdir" value=1><br>
<br>
Then in my main HTML page I put these two lines:<br>
<br>
<input type="hidden" name="zoomsize" value="[zoomsize]"><br>
<input type="hidden" name="zoomdir" value="[zoomdir]"><br>
<br>
I did this just to avoid getting any "document.mapserv.zoomdir.value has
no properties" errors. Please also note that you must have named your HTML
form "mapserv" in order to use my code word-for-word, for example, my HTML
FORM tag looks like this:<br>
<br>
<form method=GET name="mapserv" action="[program]"><br>
<br>
If the word after the "name=" in your form tag looks any different, then
you need to substitute all the "mapserv" words in my javascript code with
whatever you have named your form.<br>
<br>
Hope this helps,<br>
<br>
Mike<br>
<pre wrap=""></pre>
<br>
Rob Holloway wrote:<br>
<blockquote type="cite" cite="mid:20020905130317.15649.qmail@web12505.mail.yahoo.com">
<pre wrap="">Hi <br><br>I tried the code you supplied but I'm still having<br>some problems. The button only works after I have<br>manually selected my pan radio button - for some<br>reason the document.mapserv.zoomdir.value = 1; <br>doesn't seem to work. Have any ideas?<br><br>Cheers<br><br>Rob<br><br>--- Mike Smith <a class="moz-txt-link-rfc2396E" href="mailto:nospam@cnrit.tamu.edu"><nospam@cnrit.tamu.edu></a> wrote:<br></pre>
<blockquote type="cite">
<pre wrap="">I borrowed this javascript function from the<br>mapserver mail archive and <br>it works for me. Just put this code in the head<br>block of your HTML page:<br><br><SCRIPT language=JavaScript><br>function goGlobal() {<br> //select the Pan option so we won't zoom in when<br>clicking "full extent"<br> document.mapserv.zoomdir.value = 1; // NOTE that<br>my HTML form is <br>named "mapserv"<br> document.mapserv.zoomsize.value = 2; // Use your<br>form's name here <br>after "document."<br> //set image extent to the extent value in your map<br>file<br> // map extent is 33.709580 -4.999999 41.891010<br>5.682579<br> document.mapserv.imgext.value = "30.109580<br>-4.999999 48.891010 6.082579";<br> document.mapserv.imgbox.value = "-1 -1 -1 -1";<br>//used with the mapplet<br> //set center pixel coordinates - my image size is<br>565 by 670<br> document.mapserv.imgxy.value = "232.5 335.0";<br> document.mapserv.submit();<br>}<br></SCRIPT><br><br>then c
all the function from any image (for example)<br>using the "onClick" <br>action like this:<br><br><img src="global.jpg" onClick="goGlobal();"><br><br>Hope this helps,<br><br>Mike Smith<br><br>Steve Lime wrote:<br><br></pre>
<blockquote type="cite">
<pre wrap=""><br></pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->------------------------------------------------------------------------<br></pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">Subject:<br><br>full extent<br>From:<br><br>Rob Holloway <a class="moz-txt-link-rfc2396E" href="mailto:rholloway_1999@yahoo.com"><rholloway_1999@yahoo.com></a><br>Date:<br><br>Wed, 4 Sep 2002 11:14:46 -0700 (PDT)<br>To:<br><br><a class="moz-txt-link-abbreviated" href="mailto:mapserver-info@lists.gis.umn.edu">mapserver-info@lists.gis.umn.edu</a><br><br><br>Hi<br><br>I'm trying to create a zoom to full extent button<br>without much success. Does anyone have any<br>suggestions/code to offer. Thanks!<br><br>Rob<br><br>__________________________________________________<br>Do You Yahoo!?<br>Yahoo! Finance - Get real-time stock quotes<br><a class="moz-txt-link-freetext" href="http://finance.yahoo.com">http://finance.yahoo.com</a><br><br><br></pre>
</blockquote>
<pre wrap=""><br></pre>
</blockquote>
<pre wrap=""><!----><br><br>__________________________________________________<br>Do You Yahoo!?<br>Yahoo! Finance - Get real-time stock quotes<br><a class="moz-txt-link-freetext" href="http://finance.yahoo.com">http://finance.yahoo.com</a><br><br><br></pre>
</blockquote>
<br>
</body>
</html>