如何使用按钮中的链接传递用户在搜索栏中输入的值。
<form>
<input type="text" id="search" class="st-search-input search-field" value="abc"/>
<button type="submit" onclick='window.open("test4?abcd=\"search.value\"");'>Submit</button>
</form>
答案 0 :(得分:1)
<form>
<input type="text" id="search" class="st-search-input search-field" value="abc"/>
<button type="button" onclick='javascript: window.open("test4?abcd="+ document.getElementById("search").value);'>Submit</button>
</form>
OR
<form action="test4" target="_blank">
<input type="text" name="abcd" value="abc">
<button type="submit">Submit</submit>
</form>