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

怎么写search的函数。比如一个text框,然后onclick直接用百度search
如题

------解决方案--------------------
<title>无标题文档</title>
<script type="text/javascript">
function finds(){
var a=document.getElementById("test").value;
window.open("http://www.baidu.com/s?wd="+encodeURIComponent(a));
}
</script>
</head>

<body>
<input type="text" id="test">
<input type="button" onclick="finds()" value="find">
</body>
不知这样行不行 试了几个貌似可以 以前看到过一个例子 忘了放哪了 我给你找找
------解决方案--------------------
getElementsByName("test")[0].value
------解决方案--------------------
探讨

引用:

<title>无标题文档</title>
<script type="text/javascript">
function finds(){
var a=document.getElementById("test").value;
window.open("http://www.baidu.com/s?wd="+encodeURICompo……