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?

function gotourl(){
        var text=document.getElementById("txtMyTextbox").value;
        document.location =""+text
<input type="text" id="txtMyTextbox"/>
<input type="submit" value="submit" onClick="gotourl()"/>
Who is Participating?
hieloConnect With a Mentor Commented:
<input type="submit

<input type="button

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

Open in new window

detmersAuthor Commented:
Solution worked - thanks for the fix!
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.