// 显示添加车站窗口信息 GEvent.addListener(map, "click", function(overlay, latlng) { if (latlng) { //Add 20091207 start 实现在地图中只存在一个图标 if(marker){ map.removeOverlay(marker); } //Add 20091207 end 实现在地图中只存在一个图标 marker = new GMarker(latlng, {draggable:true}); GEvent.addListener(marker, "click", function() { var html = "<table>" + "<tr><td>名称:</td> <td><input type='text' id='name'/> </td> </tr>" + "<tr><td>地址:</td> <td><input type='text' id='address'/></td> </tr>" + "<tr><td>类型:</td> <td><select id='type'>" + "<option value='1' SELECTED>一级站</option>" + "<option value='2'>二级站</option>" + "<option value='3'>三级站</option>" + "<option value='4'>四级站</option>" + "<option value='5'>五级站</option>" + "</select> </td></tr>" + "<tr><td></td><td><input type='button' value='保存' οnclick='saveData()'/></td></tr></table>"; marker.openInfoWindow(html); }); map.addOverlay(marker); } }); function saveData() { var name = encodeURI(document.getElementById("name").value); var address = encodeURI(document.getElementById("address").value); var type = document.getElementById("type").value; var marker_type; if(type==1){ marker_type = 'blue'; } if(type==2){ marker_type = 'green'; } if(type==3){ marker_type = 'yellow'; } if(type==4){ marker_type = 'purple'; } if(type==5){ marker_type = 'red'; } var latlng = marker.getLatLng(); var lat = latlng.lat(); var lng = latlng.lng(); var url = "servlet/Sqlinfo_addrow?name=" + name + "&address=" + address + "&type=" + type + "&marker_type=" + marker_type + "&lat=" + lat + "&lng=" + lng; GDownloadUrl(url, function(data, responseCode) { if (responseCode == 200 && data.length <= 1) { marker.closeInfoWindow(); document.getElementById("message").innerHTML = "标记增加成功!"; myrefresh();//新增后刷新页面 } }); }