Hi Guys,
I’m trying to build a very simple script that takes the value from a text box and places it within a link (as a parameter) then execute the link afterwards.
So the link would basically look like this
[CODE]http://request.com/action.jsp?parameter={{insert}}
And the value from the text will be placed where {{insert}} is.
And a value from a text box :
[CODE]<input type=”text” name=”tube” id=”linkText”>
So far I have got this:
[CODE]<html>
<head>
<script>
var link = document.getElementById(‘linkid’),
textBox = document.getElementById(‘textInputId’);
function setLinkParam() {
link.href = ‘http://request.com/action.jsp?parameter=’ + textBox.value;
}
textBox.addEventListener(‘change’, setLinkParam);
</script>
</head>
<body>
<input type=”text” id=”textInputId”></input>
<a href=”http://event.com/action.jsp?param=” id=””linkid”>Link</a>
<input type=”submit” value=”Submit” action”setLinkParam()”>
</body>
</html>
But I’m not sure what bit I have wrong, can someone point me in the right direction and tell me why it doesn’t (this is a learning exercise).
Cheers!