Appending user-supplied parameter to url

Posted on 2010-01-07
Last Modified: 2012-05-08
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()"/>
Question by:detmers
    LVL 82

    Accepted Solution

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

    Open in new window


    Author Comment

    Solution worked - thanks for the fix!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
    This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
    The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be Log into your Hosting account. IPage will be used for demonstration : Locat…
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now