我有一个使用母版页的 ASP.NET 页面。我有一个脚本,我想做的是重写 HTML 的输出,只给我一个没有所有 HTML 标题等的街道名称。
这是脚本,你能告诉我如何做到这一点吗?
function getAddress(Latitude, Longitude) {
var geocoder = new google.maps.Geocoder();
var Lat = parseFloat(Latitude);
var Lng = parseFloat(Longitude);
var latlng = new google.maps.LatLng(Lat, Lng);
geocoder.geocode({ 'latLng': latlng }, function (results, status) {
if (status === google.maps.GeocoderStatus.OK) {
// document.clear();
document.open();
document.write(results[0].formatted_address);
document.close();
}
else {
// Do nothing
document.open();
document.write('');
document.close();
}
geocoder = null;
});
}
我不必使用母版页(我可能会在发布此问题后尝试不使用)。
我知道 document.write 被认为是不好的做法,但上面只是我正在尝试做的一个例子。
我将使用 HTTP 请求等从我的 VB.NET 应用程序调用此页面,所以我想要返回的只是一个带有街道名称的纯文本文件。