Jump to content

Please help refresh part of my web page!


UG1234

Recommended Posts

Hi,

 

I am using Javascript to display a map with a marker (Using OS OpenSpace). However my marker coordinates can change whilst the user is viewing the map so i would like the Marker function code to refresh and re-plot the marker every 10 seconds however i cannot work out how to do this. Adding HTML refresh command <meta http-equiv="refresh" content="10"> obviously causes the whole map to refresh.

 

I have read that AJAX can refresh parts of the webpage without the user knowing but i have no clue how to do this. Can anyone recommend any good tutorials or point me in the right direction please.

 

My code is below, i would like the marker function within the webpage  to refresh

 

Thanks for any help in advance

 

 

<script type="text/javascript">

 

var osMap;

 

function init()

{

osMap = new OpenSpace.Map('map');

 

osMap.setCenter(new OpenSpace.MapPoint(439300, 114760), 8);

 

}

 

function marker()

{

 

var markers = new OpenLayers.Layer.Markers("Markers");

osMap.addLayer(markers);

 

// Default icon

var pos = new OpenSpace.MapPoint(438760, 114760);

var marker = new OpenLayers.Marker(pos);

 

markers.addMarker(marker);

}

 

</script>

</head>

<body onload="init(); marker()">

 

Thanks for any help in advance

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.