Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass through value in text box in URL.

Status
Not open for further replies.

static786

Programmer
Feb 13, 2006
23
GB
I have an input box and I want to take the value entered in the imput box and pass it as a value through the url. Such that:

<input name="selected" type="text">

<a href="search_action.cfm?zoom=javaScript:document.pcSearch.selected.value">Zoom</a>

But it does'nt work?

 
You'd really be much better off using a submit button for this as this is the default behavior for submit buttons. However, if you'd like to work something up in javascript so that you can use an anchor instead, here's a quick example:
Code:
<script type="text/javascript">
function updateLink(str) {
   var a = document.getElementById("thelink");
   a.href = "search_action.cfm?zoom=" + str;
}
</script>

<input name="selected" type="text" onkeyup="updateLink(this.value)">

<a href="search_action.cfm?zoom=100" id="thelink">Zoom</a>

-kaht

[small] <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
[banghead] [small](He's back)[/small]
 
I found the method of updating the anchors very usefull. Thanks.
 
[thumbsup2]

-kaht

[small] <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
[banghead] [small](He's back)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top