解决方案 »
- 我用S2SH 整合 AJAX 做一个简单的登录界面,无法获取json对象,而是获得一个html数据
- 解析这样一个字符串的方法
- java菜鸟的开发方向问题
- Java的学习之路
- 在b/s系统中增加扫描功能。
- 有人用过eWebEditor么??着急啊!!
- 大家帮忙看看这个JSTL的问题,从ArrayList中取得map对象,并迭代出map
- 我怎么学不好JAVA呢?
- hibernate 在select 中怎样表达乘除这样的运算呢?
- 怎么让xml在客户端用xslt解析呢?
- jpa注解@Temporal(TemporalType.DATE) 在页面显示的是十一月 17, 2013 怎么日期导出xls是41595这样的数字
- 微信IM 即时通讯发送视频如何保证文件大小?
+ item.title + "'>[" + item.fType +"]"+ title +"</a>
function abc(){}
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<script>
$(document).ready(function() {
var o = [];
o.push("1");
o.push("2");
o.push("3");
$.each(o,
function(i, item) { $("#taskData").append("<tr height=\"22\"><td colspan=\"2\"><a style=\"cursor:pointer\" title='" + item.title + "'>[" + item + "]" + item + "</a></td><td width=\"120\" colspan=\"2\" style='color:#888'>" + item + "<td>")
});
$("a").bind("click",
function() {
alert($(this).html());
});
});
</script>
</head>
<body>
<table id="taskData">
</table>
</body></html>
"<tr height=\"22\"><td colspan=\"2\"><a style=\"cursor:pointer\"><a title='"
+ item.title + "' href=\"javascript:xxx();\">[" + item.fType +"]"+ title +"</a></td><td width=\"120\" colspan=\"2\" style='color:#888'>" + item.createTime + "<td>"
function xxx(){....}
var ers = null;
$("#searchbtn").click( function() {
$("#nodelist").html(""); var searchText = $("#searchtext").val();
var url = $("#path").val() + "/map_search.do";
$.post(url, {
"name" : searchText
}, function(data) {
if (data.items == "") {
$("#nodelist").html("没有匹配的数据").css("color", "red");
return;
}
$("#nodelist").css("color", "blue").append(
"<table id='nodetable'><thead><tr><th>gid</th>"
+ "<th>name</th>" + "<th>kind</th>"
+ "<th>geom</th>" + "<th>经度</th>"
+ "<th>纬度</th>"
+ "</tr></thead></table>");
var table = $("#nodetable"); if (ers != null) {
map.removeLayer(ers);
}
ers = new OpenLayers.Layer.Markers("Markers");
map.addLayer(ers);
$.each(data.items, function(i, v) {
var gid = v.gid == null ? "" : v.gid;
var name = v.name == null ? "" : v.name;
var kind = v.kind == null ? "" : v.kind;
var geom = v.geom == null ? "" : v.geom;
var lon = v.lon == null ? "" : v.lon;
var lat = v.lat == null ? "" : v.lat;
table.append("<tr><td>" + gid + "</td>" + "<td><a href='javascript:moveLonLat("+lon
+","+lat+")'>"
+ name + "</a></td>" + "<td>" + kind + "</td>"
+ "<td>" + geom + "</td>" + "<td>" + lon
+ "</td>" + "<td>" + lat + "</td>"
+ "</tr>");
//POINT(114.03758592 22.57226001)
/* var point = geom.replaceAll("POINT|\\(|\\)","");
var strPoint = point. */
var size = new OpenLayers.Size(21, 25);
var offset = new OpenLayers.Pixel(-(size.w / 2),
-size.h);
var icon = new OpenLayers.Icon(
'openlayers/img/er.png', size, offset);
ers.addMarker(new OpenLayers.Marker(
new OpenLayers.LonLat(lon, lat), icon));
if(i==0){
moveLonLat(lon, lat);
}
});
});
});
});
function moveLonLat(lon, lat) {
map.panTo(new OpenLayers.LonLat(lon, lat));
map.zoomTo(6);
}