<p>
In the browser
</p>
<p style="text-align:justify;">
<span style="font-size: 16px; line-height: 2; font-family: Tahoma; background-color: rgb(255, 229, 0);">
In conclusion, the polysaccharides from two seaweeds, Porphyra haitanensis and Enteromorpha prolifera changed significantly
fecal microbiota content among the three groups at all levels.
<strong>The results suggest that polysaccharide type</strong> and glycoside may contribute to shaping mice gut microbiota.
Furtherly, we will determent their effect on fecal microbiota in the treatment of certain diseases.
</span>
</p>
var p = $('p');
parseHTML(p);
function parseHTML(p) {
for (var i = 0, length = p.length; i < length; i++) {
var e = $(p[i]);
if (e.children().length == 0) {
e.html(function(index, oldHtml) {
return oldHtml.replace(/\b(\w+?)\b/g, '<i class="word">$1</i>')
});
e.click(function(event) {
if (event.target.tagName === 'I') {
alert(event.target.innerHTML);
}
});
} else {
parseHTML(e.children());
}
}
}
http://photo.weibo.com/1771131114/photos/large/photo_id/4243484310650850/album_id/3483606186757120
var p = $('p');
p.html(function(index, oldHtml) {
return oldHtml.replace(/(<\/?.+?>)|(\b(\w+?)\b)/g, function(tag) {
console.log(tag);
if (tag.indexOf('<') == -1 && tag.indexOf('nbsp') == -1) {
return '<i>' + tag + '</i>';
} else {
return tag;
}
});
});
p.click(function(event) {
if (event.target.tagName === 'I') {
alert(event.target.innerHTML);
}
});
1
InternetExplorer 2018-05-25 09:55:58 +08:00
|
2
misaka20 OP @InternetExplorer 由于是移动端,所以要求是点击,而不是类似于金山划词翻译。
|