-2
我现在正在构建一个包含搜索框的网页。如何根据搜索框上的输入创建一个搜索查询?根据用户输入动态创建http链接
<input type=text name="searchquery"/>
<input type=button name=search value="search" onClick=changeQuery()/>
changeQuery(){
????
}
我现在正在构建一个包含搜索框的网页。如何根据搜索框上的输入创建一个搜索查询?根据用户输入动态创建http链接
<input type=text name="searchquery"/>
<input type=button name=search value="search" onClick=changeQuery()/>
changeQuery(){
????
}
无论如何,我设法得到所需的输出...
<input type=text id='sq' name="searchquery"/>
<input type=button name=search value="search" onClick=changeQuery()/>
changeQuery(){
var input_query=document.getElementById('sq').value;
window.location="http://www.google.com/search?q="+input_query+"myString";
}
要放置链接
? –
“创建搜索查询”是什么意思?你是否试图伪造提交表单?仅仅使用表单有什么问题? – Quentin
@MuhammadUsman在标记 – Mohanavel