OpenMarine

Full Version: dynamically editing a html page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm new at this but loving what I am seeing. I'm trying to take my current lat/long and make a local html file along these lines Embed VesselFinder map into your website - VesselFinder

Essentially it's just take this:
<script type="text/javascript">
   // Map appearance
   var width="100%";         // width in pixels or percentage
   var height="300";         // height in pixels
   var latitude="36.00";     // center latitude (decimal degrees)
   var longitude="-5.40";    // center longitude (decimal degrees)
   var zoom="8";             // initial zoom (between 3 and 18)
</script>
<script type="text/javascript" src="https://www.vesselfinder.com/aismap.js"></script>



and replace the lat/long with my current position and change the zoom to my preferred. See attached.
My problem is that when I debug and copy the generated text to a new html file on my desktop it works great. When I click on the generated button it takes me to the vesselfinder page but doesn't do any of the customisations. What am I doing wrong?

Cheers
(2022-05-31, 09:21 PM)marty_c Wrote: [ -> ]I'm new at this but loving what I am seeing. I'm trying to take my current lat/long and make a local html file along these lines Embed VesselFinder map into your website - VesselFinder

Essentially it's just take this:
<script type="text/javascript">
   // Map appearance
   var width="100%";         // width in pixels or percentage
   var height="300";         // height in pixels
   var latitude="36.00";     // center latitude (decimal degrees)
   var longitude="-5.40";    // center longitude (decimal degrees)
   var zoom="8";             // initial zoom (between 3 and 18)
</script>
<script type="text/javascript" src="https://www.vesselfinder.com/aismap.js"></script>



and replace the lat/long with my current position and change the zoom to my preferred. See attached.
My problem is that when I debug and copy the generated text to a new html file on my desktop it works great. When I click on the generated button it takes me to the vesselfinder page but doesn't do any of the customisations. What am I doing wrong?

Cheers

Ended up being a lot easier than I thought. I just created global variables for latitude and longitude and then used this.

<script type="text/javascript">
    // Map appearance
    var width="100%";         // width in pixels or percentage
    var height="600";         // height in pixels
    var latitude={{global.latitude}};
    var longitude={{global.longitude}};
    var zoom="13";             // initial zoom (between 3 and 18)
</script>
<script type="text/javascript" src="https://www.vesselfinder.com/aismap.js"></script>