Just follow with one last question. I have received the following form.
& lt; Body onload = "initialize ()" onunload = "GUnload ()" & gt; & Lt; Form action = "welcome.php" method = "post" & gt; Name: & lt; Input type = "text" name = "fname" /> & Lt; Br / & gt; & Lt; Br / & gt; Details: & lt; BR & gt; & Lt; TEXTAREA NAME = "Description" COLS = 40 ROWS = 6> gt; & Lt; / TEXTAREA & gt; & Lt; Br / & gt; & Lt; Div id = "map_canvas" style = "width: 500px; height: 300px" & gt; & Lt; / Div & gt; & Lt; Br / & gt; Latitude: & lt; INPUT NAME = "lat" size = 20 MAXLENGTH = 40 oncpress = "Return numbers only (this, event)" & gt; & Lt; Br / & gt; Longitude: & lt; INPUT NAME = "lng" size = 20 MAXLENGTH = 40 onKeyPress = "Return only numbers (this, event)" & gt; & Lt; Input type = "submit" / & gt; & Lt; / Form & gt; & Lt; / Body & gt; and the following Google API JavaScript ...
& lt; Script type = "text / javascript" & gt; Function initialize () {if (GBrowserIsCompatible ()) {var map = new GMap2 (document.getElementById ("map_canvas")); Map.setCenter (New GLatLng (53.347247, -6.25 9 31), 13); Map.setUIToDefault (); GEvent.addListener (map, "click", function (overlay, label) {// Display lat / lng in the document of latitude / LNG areas of your form .getElementById ("lat"). Value = latLng.lat () ; Document GetElementById ("lng"). Value = latLng.lng ();}); }} & Lt; / Script & gt; Actually I am putting latitude and longitude of a position in the latitude + LF field of the form, but it is not copying .. Why? What am i doing wrong
If the document is using getElementById (), then your input elements will have "Latitude" and "lng" of the ID , together with the name of Latitude and when you pass the form, it means:
& lt; Input type = 'text' id = 'lat' name = 'lat' & gt; You can think of IDs about what DOM uses to identify which element, and name, as the browser passes in GET / POST.
Comments
Post a Comment