Jump to content

open map block within Javascript block

Recommended Posts

I can open map on a button click in Javascript, but I need to be able to open a map with a gps coordinates that change what I would like is to open a map block with these new coordinates.  If that is not possible set the button code to open the map also with these new coordinates.

<html>
<body>
<p id="demo"></p>
<form>
    <label><b>message1</b></label>
    <input type="text" name="message" id="msg1">
    <label><b>Number</b></label>
    <input type="text" name="message" id="msg2">
</form>  
<input type="submit" onclick="showInput();"><br/>

<input type="button" onclick="location.href='http://maps.apple.com/?daddr='+'result[0][2]';" value="Apple Maps" /> // or googlemaps is fine too

</body>
<script>
function showInput() 
{
   // Do some stuff that changes the coordinates
   var lat= 41.4837;
   var lng = -72.876;

   // Here i would like to set the lat lng of the maps block and insert it to my webpage or open the map above to these new coordinates so when the user clicks it goes to this address. 
}
Link to comment
  • Replies 0
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.