In the above JSP i am trying to pass the text box value through href tag. I came across the above syntax in stackoverflow. But it does not seem to be working. Need help.
HTML
<input id="orderedItems" type="text" name="orderedItems" value="hiii" />
<a href='products.jsp?id=1&loginid=${userName}&orderim='+ document.getElementById('orderedItems').value;>
答案 0 :(得分:0)
您应该在输入的onchange事件中更改href属性。
var link = document.getElementById("link"),
txt = document.getElementById("txt"),
baseUrl = link.href;
txt.onchange = function() {
link.href = baseUrl + "?param=" + this.value;
};