UG1234 Posted January 24, 2010 Share Posted January 24, 2010 Hi, I am using Javascript to displayi 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 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 tried creating a refresh function that calls the marker function i created that plots the marker as shown below. however the marker looks like it refreshes as the marker flashes every 10 seconds however it does not replot if the coordinates if they have changed. Is it possible to refresh a function within a webpage? 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), ; } function refresh() { setInterval('marker()', 10000); } 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(); refresh()"> Thanks for any help in advance Quote Link to comment Share on other sites More sharing options...
catherinesea Posted January 25, 2010 Share Posted January 25, 2010 Check the article on CodeProject to see if it helps: http://www.codeproject.com/KB/HTML/topten.aspx Thanks, --------------------- Catherine Sea http://www.dynamsoft.com http://www.scmsoftwareconfigurationmanagement.com Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.