日期:2014-05-16  浏览次数:20344 次

如何点击文字执行js

如何在文本里输入内容,然后点击百度搜索执行搜索

<style>
.one{
width:100px; 
height:20px;
border:1px solid #FF1001;
}
</style>
<script>document.getElementById('bd').onclick=function(e){var v=document.getElementById('search').value;window.open('http://www.baidu.com/s?wd='+v);}

</script>

  <input name="textfield" type="text" id="search" />

<div id="bd" class="one">百度搜索</div>

------解决方案--------------------
直接用百度的api
http://help.baidu.com/question?prod_en=search&class=500&id=1000664
------解决方案--------------------
脚 本拿到容器下边
------解决方案--------------------
获取文本参数,通过url跳转到百度搜索,你还有什么问题,你不都是这么做的。