积极答复者
CRM中实现MapPoint地图搜索功能

问题
答案
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <script type="text/jscript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6"></script> <script type="text/jscript" language=javascript> // Create the map function GetMap() { // Address1: Street 1 var address = ""; var addressLine1 = parent.document.forms[0].all.address1_line1.DataValue; // Postal Code var postalCode = ""; var lookupItem = new Array; lookupItem = parent.document.forms[0].all.address1_postalcode.DataValue; if (lookupItem && lookupItem[0] != null) { postalCode = lookupItem[0].name ; } // City var city = parent.document.forms[0].all.address1_city.DataValue; // Province/State var stateOrProvince = ""; var provinceLookup = parent.document.forms[0].all.new_provinceid.DataValue; if (provinceLookup[0] != null) { stateOrProvince = provinceLookup[0].name; } // Country var country = parent.document.forms[0].all.new_countryid.DataValue; // Compose customer address if (addressLine1 != null) { address = address + addressLine1.replace(",", "") + ", "; } if (postalCode != null) { address = address + postalCode + " "; } if (city != null) { address = address + city + " "; } if (stateOrProvince != null) { address = address + stateOrProvince + " "; } if (country != null) { address = address + country; } var Infotot=""; var companyname = parent.document.forms[0].all.name.DataValue; if (companyname != null) { Infotot = companyname; } var myp = document.getElementById('pinfotot'); if (myp != null) { myp.innerHTML= '<b>' + Infotot + '</b>' + ' ' + address; map = new VEMap('myMap'); map.LoadMap(new VELatLong(44.407174685222856, 8.93439531326294), 10 ,'r' ,false); map.Find(null,address,null,null,0,1,true,true,true,true,FindCallBack); } } // Find the address function FindCallBack(shapeLayer, results, positions, moreResults, e) { if(positions != null && positions.length > 0) { latlong = new VELatLong(positions[0].LatLong.Latitude,positions[0].LatLong.Longitude); customerPushPin = new VEShape(VEShapeType.Pushpin,latlong); var companyname = parent.document.forms[0].all.name.DataValue; if (companyname != null) { customerPushPin.SetTitle(companyname); } map.AddShape(customerPushPin); map.SetCenterAndZoom(latlong,12); } } </script> </head> <body onload="GetMap();"> <p style="padding:0px; margin:0px; font-size: 11px; font-family: tahoma;" id="pinfotot"></p> <div id='myMap' style="position:relative; width:700px; height:400px; ">Loading map...</div> </body> </html>
自己在ISV下面建个名字叫map.html的文件,将那些数据拷贝进去就差不多了。- 已建议为答案 Batistuta CaiModerator 2009年5月24日 5:14
- 已标记为答案 Batistuta CaiModerator 2009年8月1日 3:58
全部回复
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <script type="text/jscript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6"></script> <script type="text/jscript" language=javascript> // Create the map function GetMap() { // Address1: Street 1 var address = ""; var addressLine1 = parent.document.forms[0].all.address1_line1.DataValue; // Postal Code var postalCode = ""; var lookupItem = new Array; lookupItem = parent.document.forms[0].all.address1_postalcode.DataValue; if (lookupItem && lookupItem[0] != null) { postalCode = lookupItem[0].name ; } // City var city = parent.document.forms[0].all.address1_city.DataValue; // Province/State var stateOrProvince = ""; var provinceLookup = parent.document.forms[0].all.new_provinceid.DataValue; if (provinceLookup[0] != null) { stateOrProvince = provinceLookup[0].name; } // Country var country = parent.document.forms[0].all.new_countryid.DataValue; // Compose customer address if (addressLine1 != null) { address = address + addressLine1.replace(",", "") + ", "; } if (postalCode != null) { address = address + postalCode + " "; } if (city != null) { address = address + city + " "; } if (stateOrProvince != null) { address = address + stateOrProvince + " "; } if (country != null) { address = address + country; } var Infotot=""; var companyname = parent.document.forms[0].all.name.DataValue; if (companyname != null) { Infotot = companyname; } var myp = document.getElementById('pinfotot'); if (myp != null) { myp.innerHTML= '<b>' + Infotot + '</b>' + ' ' + address; map = new VEMap('myMap'); map.LoadMap(new VELatLong(44.407174685222856, 8.93439531326294), 10 ,'r' ,false); map.Find(null,address,null,null,0,1,true,true,true,true,FindCallBack); } } // Find the address function FindCallBack(shapeLayer, results, positions, moreResults, e) { if(positions != null && positions.length > 0) { latlong = new VELatLong(positions[0].LatLong.Latitude,positions[0].LatLong.Longitude); customerPushPin = new VEShape(VEShapeType.Pushpin,latlong); var companyname = parent.document.forms[0].all.name.DataValue; if (companyname != null) { customerPushPin.SetTitle(companyname); } map.AddShape(customerPushPin); map.SetCenterAndZoom(latlong,12); } } </script> </head> <body onload="GetMap();"> <p style="padding:0px; margin:0px; font-size: 11px; font-family: tahoma;" id="pinfotot"></p> <div id='myMap' style="position:relative; width:700px; height:400px; ">Loading map...</div> </body> </html>
自己在ISV下面建个名字叫map.html的文件,将那些数据拷贝进去就差不多了。- 已建议为答案 Batistuta CaiModerator 2009年5月24日 5:14
- 已标记为答案 Batistuta CaiModerator 2009年8月1日 3:58