1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| <html>
<head>
<title>Exemple</title>
</head>
<body>
<div id="dvTest">
<p>salut les developpeurs, soyez le bien venu chez developpez :)</p>
<p><img src="img/develop.png" alt="develop" title="develop" /></p>
</div>
<script type="text/javascript">
var html=window.document.getElementById("dvTest");
html.innerHTML=replaceAll("develop","<span style=\"color:#f00;\">develop</span>",html.innerHTML);
function replaceAll(find, replace, str) {return str.replace(new RegExp(find, 'gi'), replace);}
</script>
</body>
</html> |
Partager