Appending user-supplied parameter to url

Hello -

I am using a solution supplied by William007 that takes user-input, appends it to a url, then launches that url.  I am using it in Form Web Part in Sharepoint.  It seemed simple enough, but when I use the code below, all I get when I press the button is a reload of the same page.  When I hoover over the submit button, the url of the current page shows up at the bottom of the browser.  What could I be missing to get this to work?

<html>
<head>
<script>
function gotourl(){
        var text=document.getElementById("txtMyTextbox").value;
        document.location ="http://sharepointtest.companyzyx.com/collaborationproject/GlobalStandards/standards/"+text
         
}
</script>
</head>
<body>
<input type="text" id="txtMyTextbox"/>
<input type="submit" value="submit" onClick="gotourl()"/>
</body>
</html>
detmersAsked:
Who is Participating?
 
hieloConnect With a Mentor Commented:
change
<input type="submit

to:
<input type="button

<input type="button" value="submit" onClick="gotourl()"/> 

Open in new window

0
 
detmersAuthor Commented:
Solution worked - thanks for the fix!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.