c# - How can I set Longitude and Latitude Positions by textboxes in asp.net? -


i have take longitude , latitude position textboxes have defined in body tag, , textboxes values should set in longitude , latitude variables have defined in javascript. code not set textboxes values in longitude , latitude variables in javascript. can me?

my code:           <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=aizasyc6v5-2uaq_wushdktm9ilcqirlptnzgek&sensor=false"></script>          <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places"></script>          <script type="text/javascript">              if (navigator.geolocation) {                 navigator.geolocation.getcurrentposition(success);             } else {                 alert("geo location not supported on current browser!");             }                      **latitude** = document.getelementbyid('latitude').value; //position.coords.latitude;                      **longitude** = document.getelementbyid('longitude').value; //position.coords.longitude;              function success(position) {                 **latitude** = document.getelementbyid('latitude').value; //position.coords.latitude;                 **longitude** = document.getelementbyid('longitude').value; //position.coords.longitude;                 var city = position.coords.locality;                 var mylatlng = new google.maps.latlng(latitude, longitude);                 var myoptions = {                     center: mylatlng,                     zoom: 12,                     maptypeid: google.maps.maptypeid.roadmap                 };                  var map = new google.maps.map(document.getelementbyid("map_canvas"), myoptions);                  var marker = new google.maps.marker({                     position: mylatlng,                     title: "lat: " + latitude + " long: " + longitude                 });                  marker.setmap(map);                 var infowindow = new google.maps.infowindow({ content: "<b>your latitude position: </b>" + latitude + "<br /><b>your longitude position: </b>" + longitude + "" });                 infowindow.open(map, marker);             }              function setvalues() {                 **latitude** = document.getelementbyid('latitude').value; //position.coords.latitude;                 **longitude** = document.getelementbyid('longitude').value; //position.coords.longitude;             }          </script>         </head>           <body>             <form id="form1" runat="server">              latitude position:      <input type="text" id="latitude" value="" placeholder="enter latitude position"/>      longitude position: <input type="text" id="longitude" value="" placeholder="enter longitude position"/>      <input type="submit" value="set" onclick="setvalues()" />            <div id="map_canvas" style="width: 500px; height: 400px"></div>              </form>         </body>         </html> 

thanks in advance

use asp textbox

<asp:textbox id="txbox" runat="server" />   

and in javacript use

$get("<%=txbox.clientid %>").value = x; 

to access it.

it may work without asp textbox using

$get("txboxid").value = x; 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -