Use JS to highlight the keywords specified in the article content
That's it...
Now there are these keywords: beauty, life, shopping
When these keywords appear in the article, highlight them..
Articles generate static pages, and these keywords can be updated at any time, so I want to use JS to implement them...
Don't know how to implement such a function? Please help me
Copy the codeThe code is as follows:
<script language="JavaScript">
function highlight(key) {
var key = ('|');
for (var i=0; i<; i++) {
var rng = ();
while ((key[i]))
//(('red'));
('<div style="border:1 solid red;display:inline"><a href="#" title="+ +">' + + '</a></div>');
}
}
highlight('Article|Key|Function')
</script>