Changeset 131
- Timestamp:
- Oct 22, 2006, 10:49:03 AM (14 years ago)
- Location:
- trunk/npemap.org.uk/static
- Files:
-
- 5 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/npemap.org.uk/static/index.html
r123 r131 8 8 <script src="tiles/dom.js"></script> 9 9 <script src="tiles/event.js"></script> 10 <script src="tiles/jsr_class.js"></script> 11 <script src="tiles/jscoord-1.1.1.js"></script> 10 12 <div id="body"> 11 13 <h1>New Popular Mapping<sup>beta</sup></h1> … … 42 44 <a href="#" id="link"> 43 45 <img src="thumbnail.jpg" style="border: none" /> 44 </a> </div> 46 </a> 47 48 <form onsubmit="return find()"> 49 <p><label for="where">Place Name</label> 50 <input id="where" name="where" /></p> 51 <p><input type="submit" name="Zoom To" /></p> 52 </form> 53 </div> 45 54 46 55 <script type="text/javascript"> 47 56 var xOffset = 62; 57 58 function find() { 59 request = 'http://ws.geonames.org/searchJSON?name=' + encodeURIComponent(document.getElementById('where').value) + '&maxRows=1&callback=getLocation&country=GB&fclass=P&style=SHORT'; 60 aObj = new JSONscriptRequest(request); 61 // Build the script tag 62 aObj.buildScriptTag(); 63 // Execute (add) the script tag 64 aObj.addScriptTag(); 65 return false; 66 } 67 68 // this function will be called by our JSON callback 69 function getLocation(jData) { 70 if (jData == null) { 71 // There was a problem parsing search results 72 return; 73 } 74 75 var geonames = jData.geonames; 76 if (geonames.length > 0) { 77 var name = geonames[0]; 78 var ll = new LatLng(name.lat,name.lng); 79 ll.WGS84ToOSGB36(); 80 var en = ll.toOSRef(); 81 var easting = Math.round(en.easting/1000); 82 var northing = Math.round(en.northing/1000); 83 window.location = "tiles/map.html#" + easting + "," + northing + ",1"; 84 } 85 else { 86 alert("Sorry, can't find that location"); 87 } 88 } 89 90 48 91 49 92 function click(e) {
Note: See TracChangeset
for help on using the changeset viewer.