javascript html页面中的内容替换
<script language="javascript">
function ffRed(){
var xsxf = document.getElementById("id");
var str2 = "字段1";
var str3 = "字段2";
var reg=eval("/"+str2+"/gi");
var reg3=eval("/"+str3+"/gi");
xsxf.innerHTML = xsxf.innerHTML.replace(reg,"<font color='#FF0000'>字段1</font>");
xsxf.innerHTML = xsxf.innerHTML.replace(reg3,"<font color='#FF0000'>字段2</font>");
}
ffRed();
</script>
想要看到更多学习笔记、考试复习资料、面试准备资料?
想要看到IBM工作时期的技术积累和国外初创公司的经验总结?
敬请关注:
[CSDN](https://blog.csdn.net/u013152895)
[简书](https://www.jianshu.com/u/594a3de3852d)
[博客园](https://www.cnblogs.com/vigorz/)
[51Testing](http://www.51testing.com/?15263728)