<!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>
<title>Untitled Page</title>
<link rev="Stylesheet" rel="Stylesheet" href="62.css" />
<script language="javascript" type="text/javascript">
var newdiv;
var d,frienddiv;
function words()
{
var friends =document.getElementById("friends");
var input=document.getElementById("input1");
var words=input.value;
var mywords=new RegExp(words);
if(document.getElementById("newdiv"))
{var product=document.getElementById("newdiv");
while(product.childNodes.length>0) { product.removeChild(product.childNodes[0]);}
var newdivclose = document.createElement("p");
newdivclose.innerHTML="<a onclick=\"closediv()\"><img border=\"0\"
src=\"close.gif\"></img><\/a>";
document.getElementById("newdiv").appendChild(newdivclose);
}
else
{var newdiv = document.createElement("div");
newdiv.id="newdiv";
var newdivclose = document.createElement("p");
newdivclose.innerHTML="<a onclick=\"closediv()\"><img border=\"0\"
src=\"close.gif\"></img><\/a>";
document.body.appendChild(newdiv);
document.getElementById("newdiv").appendChild(newdivclose);
}
for(var i=0;i<friends.childNodes.length;i++)
{
if(friends.childNodes[i].className=="friend")
{
frienda=friends.childNodes[i].getElementsByTagName("div");
for(var k=0;k<frienda.length;k++)
{
var thewords = frienda[k].className;
var thelink = frienda[k].id;
if(mywords.test(thewords))
{//alert(thewords);
var newdivdiv = document.createElement("div");
// var newa = document.createElement("a");
newdivdiv.id = "newdivdiv";
newdivdiv.innerHTML = "<a href=\"http:\/
\/www.baidu.com?"+thelink+"\">"+thewords+"</a>";
if(newdivdiv.innerHTML = "<a href=\"http:\/
\/www.baidu.com?"+thelink+"\">"+thewords+"</a>"){d=0;}
else newdivdiv.innerHTML = "<a href=\"http:\/
\/www.baidu.com?"+thelink+"\">"+thewords+"</a>";
document.getElementById("newdiv").appendChild(newdivdiv);
// newa.setAttribute("src","http://www.baidu.com");
}
else d=0;
}
}
else d=0;
}
}
function enterHandler(event)
{
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
if (keyCode == 13) {
words();
}
}
function closediv(){
var product=document.getElementById("newdiv");
while(product.childNodes.length>0) { product.removeChild(product.childNodes[0]);}
product.parentNode.removeChild(product);
}
</script>
</head>
<body>
<div id="friends">
<div class="friend">
<input id="input1" onKeyUp="enterHandler(event)"/>
<div id="001" class="aaa"></div>
<div id="002" class="sdf"></div>
<div id="003" class="231sad"></div>
<div id="004" class="dfsd"></div>
<div id="005" class="张sd"></div>
<div id="006" class="xcyrt"></div>
<div id="007" class="wert"></div>
<div id="008" class="麻辣鸡翅"></div>
<div id="009" class="大饼干"></div>
<div id="0010" class="haha"></div>
<div id="Div1" class="ddd"></div>
<div id="Div2" class="qweqwe"></div>
<div id="Div3" class="大"></div>
</div>
</div>
</body>
</html>
浙公网安备 33010602011771号