BrU32

JS Google Maps Psudo Random Location/Zoom Map Gen SRC

Jun 12th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <html>
  2. <head>
  3. <center>
  4. <script
  5. src="http://maps.googleapis.com/maps/api/js">
  6. </script>
  7.  
  8. <script>
  9. var intRnd=parseFloat(Math.random()*100.999);
  10. var inttRnd=parseFloat(Math.random()*80.000);
  11. var myCenter=new google.maps.LatLng(intRnd,inttRnd);
  12. var marker;
  13. var zoom=Math.floor(Math.random()*15);
  14.  
  15. function initialize()
  16. {
  17. var mapProp = {
  18. center:myCenter,
  19. zoom:zoom,
  20. mapTypeId:google.maps.MapTypeId.SATELLITE
  21. };
  22.  
  23. var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
  24.  
  25. var marker=new google.maps.Marker({
  26. position:myCenter,
  27. animation:google.maps.Animation.BOUNCE
  28. });
  29.  
  30. marker.setMap(map);
  31. }
  32.  
  33. google.maps.event.addDomListener(window, 'load', initialize);
  34. </script>
  35. </head>
  36.  
  37. <body>
  38. <div id="googleMap" style="width:500px;height:380px;"></div>
  39. <font color="red">
  40. <center>
  41. <h2>Refresh Browser For A Random Desination!!
  42. </center>
  43. </body>
  44. </html>
Add Comment
Please, Sign In to add comment