如何在谷歌地图上自动复制家庭地址
How to copy automatically the home address in google map?
如何将家庭地址自动直接显示到谷歌地图(maps.google.com)并显示到谷歌地图的搜索栏中?这个家庭地址是从另一个网站(UAT)与纯JAVASCRIPT?请帮帮我。我是新来的PL,所以我不熟悉。谢谢你
的例子:
在另一个网站上有一个家庭地址的文本框,输入的地址是:
345 Bury Village Oslo St. Bershka City, Switzerland
我想在谷歌地图中复制/显示整个家庭地址并自动搜索该地址
下面是我使用的代码:function scanLapVerification() {
try {
var forAlert = '';
var el = getElement(document, "class", "workflowActivityDetailPanel", "");
if (el && el.length > 0) {
var eltr = getElement(el[0], "tag", "tr", "");
if (eltr && eltr.length > 0) {
//Read Contact and Permanent address
var addresses = {
CA: { province: null, municipality: null, barangay: null, zip: null, street: null, snumber: null, building: null, floor: null}
,PA: { province: null, municipality: null, barangay: null, zip: null, street: null, building: null, bnumber: null, floor: null}
};
var address_type = null;
for (var i = 0; i < eltr.length; i++) {
tr_text = eltr[i].innerText;
if (tr_text.substr(0, "Contact address".length) == "Contact address") address_type = "CA";
if (tr_text.substr(0, "Permanent address".length) == "Permanent address") address_type = "PA";
if (address_type && tr_text.substr(0, "Province".length) == "Province") {
addresses[address_type].province = tr_text.substr("Province".length, tr_text.length - "Province".length);
forAlert = forAlert + 'Province: '+ addresses[address_type].province + ',' + address_type + ' > ';
}
if (address_type && tr_text.substr(0, "Municipality".length) == "Municipality") {
addresses[address_type].municipality = tr_text.substr("Municipality".length, tr_text.length - "Municipality".length);
forAlert = forAlert + 'Municipality: '+ addresses[address_type].municipality + ',' + address_type + ' > ';
}
if (address_type && tr_text.substr(0, "Barangay".length) == "Barangay") {
addresses[address_type].barangay = tr_text.substr("Barangay".length, tr_text.length - "Barangay".length);
forAlert = forAlert + 'Barangay: ' + addresses[address_type].barangay + ',' + address_type + ' > ';
}
if (address_type && tr_text.substr(0, "ZIP Code".length) == "ZIP Code") {
addresses[address_type].zip = tr_text.substr("Zip Code".length, tr_text.length - "ZIP Code".length);
forAlert = forAlert + 'ZIP Code: ' + addresses[address_type].zip + ',' + address_type + ' > ';
}
if (address_type && tr_text.substr(0, "Street name".length) == "Street") {
addresses[address_type].street = tr_text.substr("Street name".length, tr_text.length - "Street".length);
forAlert = forAlert + 'Street name: ' + addresses[address_type].street + ',' + address_type + ' > ';
}
if (address_type && tr_text.substr(0, "Street number".length) == "Street number") {
addresses[address_type].snumber = tr_text.substr("Street number".length, tr_text.length - "Street number".length);
forAlert = forAlert + 'Street number: ' + addresses[address_type].snumber + ',' + address_type + ' > ';
}
if (address_type && tr_text.substr(0, "Building name".length) == "Building name") {
addresses[address_type].building = tr_text.substr("Building".length, tr_text.length - "Building name".length);
forAlert = forAlert + 'Building name: ' + addresses[address_type].building + ',' + address_type + ' > ';
}
if (address_type && tr_text.substr(0, "Floor number".length) == "Floor number") {
addresses[address_type].floor = tr_text.substr("Zip".length, tr_text.length - "Floor number".length);
forAlert = forAlert + 'Floor number: ' + addresses[address_type].floor + ',' + address_type + ' > ';
}
}
//Open a new tab for Google Maps
In this place need to put the code for New tab
//Enter full address into search input
In this place need to put the code for Displaying the Home Address from another website into Google Maps search bar automatically
}
}
return { status: "KO" };
} catch (e) {
alert("Exception: scanLapVerification'n" + e.Description);
return { status: "KO", message: e };
}
};
jsfield link
您需要使用地理编码
像这样: