我刚刚找到了解决方案!:D
http://yabtb.blogspot.co.uk/2012/02/automatic-image-caption-from-img-title.html
所有功劳归于 MS-potilas。
<script src='http://code.jquery.com/jquery-latest.js' type='text/javascript'></script>
<style type='text/css'>
.caption-text { clear:both;color:#666;font-size:90%;text-align:center;margin:0 0 6px;padding:3px 0 0; }
</style>
<script type='text/javascript'>
//<![CDATA[
// Add captions to images from title tag
// by MS-potilas 2012. See http://yabtb.blogspot.com/
function addCaption(img) {
var ele=$(img);
if(ele.parent().is(".caption-wrap")) return;
var title=ele.attr('title');
if(title=="") return;
if(ele.parent().is("a")) ele=ele.parent();
var align=ele.attr("align");
if(!align) align=ele.css("float");
if(align=="") align="none";
var container=ele.wrap('<div style="display:inline-block" class="caption-wrap '+align+'" />').parent();
container.css("float", align);
container.css("width", ele.outerWidth()+"px");
container.css("margin-left", ele.css("margin-left"));
container.css("margin-right", ele.css("margin-right"));
container.css("margin-bottom", ele.css("margin-bottom"));
ele.css("margin-left", "0px");
ele.css("margin-right", "0px");
ele.css("margin-bottom", "0px");
var text=container.append('<p class="caption-text">'+title+'</p>').find(".caption-text");
text.css("width", ele.outerWidth()+"px");
}
// add captions on doc ready to img's with class "caption"
$(document).ready(function() {
$("img.caption").each(function() {
addCaption(this);
});
});
//]]>
</script>