console
(function() {
'use strict';
// Your code here...
var words = ['this','demo','man','so','cool'];
var words2 = ['这','演示','男人','如此','帅气'];
function underline(){
for(var i=0;i<words.length;i++){
document.body.innerHTML=document.body.innerHTML.replace(new RegExp(words[i],'ig'),'<a class="wavy">' + words2[i] + '</a>');
};
};
window.onload = underline;
})();
<h1>
this is a demo
</h1>
<p>
oh, this man is so cool!
</p>
<span>
haa,it's sooo~ cooool~,
<a id="go">
I like this man
</a>
</span>
body {
color: #fff;
}
p {
color: #a4a4a4;
}
a {
color: #bfb;
}
a:hover {
color: #ada;
cursor: pointer;
}
.wavy {
text-decoration:underline;
text-decoration-style: wavy;
}
#go {
width: 100px;
height: 30px;
}