Category Archives: Javascript

Javascript: Plot point on GoogleMaps using coordinates Latitude and Longitude

How to place a tack  or knife a map. Throw darts programmatically .

a google map

Here is the javascript,

you need your own google maps api key.

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
 
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?key=(YOUR_OWN_KEY)&sensor=false">
</script>
 
<script type="text/javascript">
 
function initialize() 
{
 
var myOptions = {center: new google.maps.LatLng(38.4686, -123.0028),
 zoom: 12,
 mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
 
var lat = 38.4686;		
var long = -123.0028;
 marker = new google.maps.Marker({
position: new google.maps.LatLng(lat, long),
map: map
});
 
}	  
</script>
</head>
 
<body onload="initialize()">
<div id="map_canvas" style="width:60%; height:60%"></div>
</body>
</html>

Now you can write your name on islands! : D

 

Javascript: How to parse xml, write to html5 local storage, then read from local storage, and allow user to search content.

This simple example will demonstrate how to use javascript to write to, and read from, html5 local storage.

The file being parsed and saved is books.xml.  There are two html pages here, LAUNCH.html and OFFLINE.html.

LAUNCH.html will parse the xml file and write it to the user’s browser:

OFFLINE.html will allow the user to search the content of their local storage