当前位置: 代码迷 >> JavaScript >> 求大神赐教,怎么点击某段文字,会在左侧的文本域中出现相应的文字
  详细解决方案

求大神赐教,怎么点击某段文字,会在左侧的文本域中出现相应的文字

热度:180   发布时间:2013-03-06 16:20:31.0
求大神赐教,如何点击某段文字,会在左侧的文本域中出现相应的文字?
我点击右侧的文字,在左侧会出现相应的文字,






我想要的这个效果可以看看这个网页:http://xm.875.cn/sahzt/index.html?aid=443&sid=3047
?JavaScript?div+css?

------解决方案--------------------

<style type="text/css">
#div1{
height:50px;
width:300px;
margin-left:300px;
margin-top:-150px;
padding:15px;
background-color:#8FBC8F;
border:1px solid black
}
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(function(){
$("#div1").click(function(){
$("textarea").val($("#div1").text());
});
})
 </script> 
<textarea rows="10" cols="30"></textarea>   
<div id="div1">
 此项目很好 此项目很好
  此项目很好 此项目很好
   此项目很好 此项目很好
    此项目很好 此项目很好
</div>
  相关解决方案