日期:2014-05-16 浏览次数:20369 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>google</title>
</head>
<style type="text/css">
#div{
border:1px solid black;
width:650px;
height:300px;
margin:10px auto;
font-size:12px;
}
#div1{
text-indent:200px;
margin:10px auto;
}
#div3 a{
font-size:12px;
}
</style>
<script type="text/javascript">
function rep(){
var s = document.getElementById("t").value.split(",");
for(var i = 0; i < s.length; i++){
document.getElementById("div3").innerHTML = document.getElementById("div3").innerHTML.replace(new RegExp(s[i],"gi"),s[i].fontcolor("red"));
}
}
</script>
<body>
<div id="div">
<div id="div1"><input id="t" type="text"/> <input type="button" id="btn" value="搜索" onclick="rep()"/><br /></div>
<hr />
<div id="div3">
<a href="#">多普达通讯有限公司</a><br /><br />
生产和提供多普达智能手机产品,及其配件信息<br /><br />
</div>
</div>
</body>
</html>