js 把div li 的内容在input value中显示出来
js 把div li 的内容在input value中显示出来
<!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>无标题文档</title>
<style>
a{color:#000;}
</style>
<s cript>
function selectTag(obj,vv){
//假设所有a初始字体颜色为黑色
document.getElementById("kw").value=vv;
var parentNode=obj.parentNode;
var aList=parentNode.children;
for(var i=0;i<aList.length;i++)
aList[i].style.color='#000';
obj.style.color='red';
}
</s cript>
</head>
<body>
<div>
<a href="javas cript:void(0)" onClick="selectTag(this,'网页')">网页</a>
<a href="javas cript:void(0)" onClick="selectTag(this,'新闻')">新闻</a>
<a href="javas cript:void(0)" onClick="selectTag(this,'地图')">地图</a>
<a href="javas cript:void(0)" onClick="selectTag(this,'音乐')">音乐</a>
<a href="javas cript:void(0)" onClick="selectTag(this,'图片')">图片</a>
</div>
<span>
<input id="kw" type="text" value="" size="30"></input>
</span>
</body>
</html>




































