87,845
社区成员




$.getJSON(url, function(result){
//alert(result.response.docs.length);
//alert(result.response.docs[1].key);
project_r = result.response.docs.length;
for (var i = 0; i < result.response.docs.length; i++) {
thisResult = "<tr><td style='font-size:18px;border-bottom:3px #cccccc solid;' class='td_content'>";
$.each( result.response.docs[i], function( x, item ) {
//alert("i:"+i+" item:"+item);
if(x!='_version_' && x!='rownum'){
thisResult = thisResult + x + ":" + item + "<br>";
}
});
thisResult = thisResult + "</td></tr>";
$("#result_table").append(thisResult);
}
});
$('.td_content').highlight(search_s);
$.fn.highlight = function(word) {
var pattern = new RegExp(word, 'g'),
repl = '<span style="background-color:Yellow;">' + word + '</span>';
this.each(function() {
$(this).contents().each(function() {
if(this.nodeType === 3 && pattern.test(this.nodeValue)) {
$(this).replaceWith(this.nodeValue.replace(pattern, repl));
}
else if(!$(this).hasClass('ref')) {
$(this).highlight(word);
}
});
});
return this;
};