var infoTemplate = new InfoTemplate("信息简介", "名称: ${Name}<br><br>地址: ${Name}<br><br>负责人:${Name}"); infoTemplate.setTitle("<b>${Name}</b>");
infoTemplate.setContent("名称: ${Name}<br><br>地址: ${Name}<br><br>负责人:${Name}"); var featureLayerRoad = new FeatureLayer('http://localhost:6080/arcgis/rest/services/lhx/SchoolService/MapServer/3',{mode: FeatureLayer.MODE_ONDEMAND,infoTemplate:infoTemplate,outFields: ["*"]}); var featureLayerPublic = new FeatureLayer('http://localhost:6080/arcgis/rest/services/lhx/SchoolService/MapServer/4',{mode: FeatureLayer.MODE_ONDEMAND,infoTemplate:infoTemplate,outFields: ["*"]}); var featureLayerGreen = new FeatureLayer('http://localhost:6080/arcgis/rest/services/lhx/SchoolService/MapServer/5',{mode: FeatureLayer.MODE_ONDEMAND,infoTemplate:infoTemplate,outFields: ["*"]}); var featureLayerCommunity = new FeatureLayer('http://localhost:6080/arcgis/rest/services/lhx/SchoolService/MapServer/6',{mode: FeatureLayer.MODE_ONDEMAND,infoTemplate:infoTemplate,outFields: ["*"]}); var featureLayerBuilding = new FeatureLayer('http://localhost:6080/arcgis/rest/services/lhx/SchoolService/MapServer/7',{mode: FeatureLayer.MODE_ONDEMAND,infoTemplate:infoTemplate,outFields: ["*"]}); var featureLayerApartment = new FeatureLayer('http://localhost:6080/arcgis/rest/services/lhx/SchoolService/MapServer/8',{mode: FeatureLayer.MODE_ONDEMAND,infoTemplate:infoTemplate,outFields: ["*"]}); var featureLayerRemind = new FeatureLayer('http://localhost:6080/arcgis/rest/services/lhx/SchoolService/MapServer/9',{mode: FeatureLayer.MODE_ONDEMAND,infoTemplate:infoTemplate,outFields: ["*"]}); myMap.addLayers([featureLayerRoad,featureLayerPublic,featureLayerGreen,featureLayerCommunity,featureLayerBuilding,featureLayerApartment,featureLayerRemind])我是用这个代码实现上面效果的
infoTemplate.setContent("名称: ${Name}<br><br>地址: ${Name}<br><br>负责人:${Name}"); var featureLayerRoad = new FeatureLayer('http://localhost:6080/arcgis/rest/services/lhx/SchoolService/MapServer/3',{mode: FeatureLayer.MODE_ONDEMAND,infoTemplate:infoTemplate,outFields: ["*"]}); var featureLayerPublic = new FeatureLayer('http://localhost:6080/arcgis/rest/services/lhx/SchoolService/MapServer/4',{mode: FeatureLayer.MODE_ONDEMAND,infoTemplate:infoTemplate,outFields: ["*"]}); var featureLayerGreen = new FeatureLayer('http://localhost:6080/arcgis/rest/services/lhx/SchoolService/MapServer/5',{mode: FeatureLayer.MODE_ONDEMAND,infoTemplate:infoTemplate,outFields: ["*"]}); var featureLayerCommunity = new FeatureLayer('http://localhost:6080/arcgis/rest/services/lhx/SchoolService/MapServer/6',{mode: FeatureLayer.MODE_ONDEMAND,infoTemplate:infoTemplate,outFields: ["*"]}); var featureLayerBuilding = new FeatureLayer('http://localhost:6080/arcgis/rest/services/lhx/SchoolService/MapServer/7',{mode: FeatureLayer.MODE_ONDEMAND,infoTemplate:infoTemplate,outFields: ["*"]}); var featureLayerApartment = new FeatureLayer('http://localhost:6080/arcgis/rest/services/lhx/SchoolService/MapServer/8',{mode: FeatureLayer.MODE_ONDEMAND,infoTemplate:infoTemplate,outFields: ["*"]}); var featureLayerRemind = new FeatureLayer('http://localhost:6080/arcgis/rest/services/lhx/SchoolService/MapServer/9',{mode: FeatureLayer.MODE_ONDEMAND,infoTemplate:infoTemplate,outFields: ["*"]}); myMap.addLayers([featureLayerRoad,featureLayerPublic,featureLayerGreen,featureLayerCommunity,featureLayerBuilding,featureLayerApartment,featureLayerRemind])我是用这个代码实现上面效果的