PDA

View Full Version : Using forms to get a value to be used in a link


pcrombie
09-18-2002, 02:20 PM
I am trying to use a text box for a user to enter their initals into, and then when click a button, the users initials are added to a link so they can access their web site....
eg..

<form name="form1" method="post" action="">
<p>
<input type="text" name="un">
Username</p>
<p>
<input type="submit" onClick="window.navigate('https://my.website.ac.uk/exchange/' + un +)" name="Submit" value="Submit">
</p>
</form>


with UN being the users initals so when the button is pressed it will open up the hyperlink in te same page!?

I'm very new to javascript and i am just guessing really??
Thanks

Phil

Mr J
09-18-2002, 03:01 PM
Your going to need something like this:


<script>

function whereto(){
overthere=document.form1.taxi.value
location="http://www.my.website.ac.uk/exchange/"+ overthere
}

</script>



<form name="form1" method="post" action="">
<p> <input type="text" name="taxi"> Username</p>
<p> <input type="button" onClick="whereto()" value="Go">
</p>
</form>