View Single Post
Old 02-03-2013, 04:16 AM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,542
Thanks: 62
Thanked 4,054 Times in 4,023 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Well, just for starters, you need to stop using document.write(). document.write() ceased being NEEDED when Netscape 4 replaced Netscape 3 and became even less helpful once MSIE 5 arrived. Say about 13 years ago.

And then:
Code:
<a id="maplink1"><img id="mapimg" style="border: none;"></a>
....
... 
<script type="text/javascript">
var link = document.getElementById("maplink");
var image = document.getElementById("mapimg");

var vzoom=15
var vsize="640x640"
var vmaptype="roadmap"
var x1=51.363244, y1=4.847011;
var x2=x1-10, y2=y1-10;

link.href = "http://maps.googleapis.com/maps/api/staticmap"
          + "?center=" + x1 + "," + y1
          + "&zoom=" + vzoom 
          + "&format=png"
          + "&sensor=false"
          + "&size=" + vsize 
          + "&maptype=" + vmaptype 
          + "&style=element:labels|visibility:off"
          + "&style=feature:transit|visibility:off"
          + "&style=feature:landscape|visibility:off"
          + "&style=feature:administrative|visibility:off"
          + "&style=feature:poi|visibility:off"
          + "&style=feature:road|color:0x808080";

image.src = "http://maps.googleapis.com/maps/api/staticmap"
          + "?center=" + x1 + "," + y1
          + "&zoom=" + vzoom
          + "&format=png"
          + "&sensor=false"
          + "&size=" + vsize
          + "&maptype=" + vmaptype
          + "&style=element:labels|visibility:off"
          + "&style=feature:transit|visibility:off"
          + "&style=feature:landscape|visibility:off"
          + "&style=feature:administrative|visibility:off"
          + "&style=feature:poi|visibility:off"
          + "&style=feature:road|color:0x808080";
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.

Last edited by Old Pedant; 02-03-2013 at 04:20 AM..
Old Pedant is offline   Reply With Quote
Users who have thanked Old Pedant for this post:
ylguf (02-03-2013)