1
我已经JQuery的如何显示在jQuery的工具提示用于动态创建的HTML表格
function draw_top_five_table(data) {
var json_array = data.json_array;
/*Top five stat entities table*/
var table_string = "<table class='common_data_grid top20' cellpadding='0' cellspacing='0' width='100%' id='top_five_table'>"
+ "<tr><td> </th><th>URL</th><th width='90'>Total Hits</th><th width='380'>Percentage of all Hits</th></tr>"
for (var json_count = 0; json_count < json_array.length; json_count++)
{
var raw_tag = "<tr><td>" + (json_count+1) + "</td>"
+ "<td><a title=" + json_array[json_count].url_name + " href=/tophundredviewreport/?key="
+ json_array[json_count].url_id + ">"
+ json_array[json_count].url_name + "</a></td>"
+ "<td align='right'><div title='<div>Facebook Hits:" + json_array[json_count].facebook_count
+ "<br/> Twitter Hits:" + json_array[json_count].twitter_count
+ "<br/> Google+ Hits:" + json_array[json_count].buzz_count
+ "<br/> LinkedIn Hits:" + json_array[json_count].linkedin_count
+ "<br/> Digg Hits:" + json_array[json_count].digg_count
+ "<br/> Delicious Hits:" + json_array[json_count].delicious_count
+ "<br/> Reddit Hits:" + json_array[json_count].reddit_count + "</div>'>"
+ json_array[json_count].total_count + "</div></td>"
+ "<td><div title='<div>Facebook Hits:"
+ (json_array[json_count].facebook_count/json_array[json_count].sum_total*100).toFixed(2) + "%"
+ "<br/> Twitter Hits:" + (json_array[json_count].twitter_count/json_array[json_count].sum_total*100).toFixed(2) + "% "
+ "<br/> Google+ Hits:" + (json_array[json_count].buzz_count/json_array[json_count].sum_total*100).toFixed(2) + "%"
+ "<br/> LinkedIn Hits:" + (json_array[json_count].linkedin_count/json_array[json_count].sum_total*100).toFixed(2) +" %"
+ "<br/> Digg Hits:" + (json_array[json_count].digg_count/json_array[json_count].sum_total*100).toFixed(2) + "%"
+ "<br/> Delicious Hits:" + (json_array[json_count].delicious_count/json_array[json_count].sum_total*100)+" %"
+ "<br/> Reddit Hits:" + (json_array[json_count].reddit_count/json_array[json_count].sum_total*100).toFixed(2) + "%</div>'"
+ "class='progress'>" + (json_array[json_count].total_count/json_array[json_count].sum_total*100).toFixed(2) + "</div></td>"
+ "</tr>"
table_string = table_string + raw_tag;
}
var end_tag = "</table>";
table_string = table_string + end_tag + "<br>";
$("#top_five_stat").html(table_string)
$('.common_data_grid td .progress').each(function(){
$this = $(this);
$percentage = $this.text();
$this.empty();
$this.wrapInner('<div class="progress_inner" />');
$('.progress_inner',$this).text(' ');
$width = ((200/100)*$percentage);
$this.animate({width:$width},3000);
$this.parent().append('<span class="number">'+ $percentage +'%</span>');
});
}
但刀尖有SA问题创建的表动态地表示击穿两列三。它没有正确渲染,并且一旦我将鼠标移到它上面,就会显示HTML元素。任何人都可以帮我解决这个问题吗?