Enter to make URL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • twiersum
    New Member
    • Jan 2009
    • 2

    Enter to make URL

    I am having a problem setting a page up so that when the user hits enter that it will run my script just as if they clicked submit. I am a dumby and have tried so many combos I am losing my mind...please help.
    [code=javascript]
    <script>

    function makeURL() {
    var baseURL = 'http://www.encompassac countingservice s.com/Accounting Client Files/';
    var nombre = document.form1. nombre.value;
    var ext = '/Financials.pdf' ;
    var url = baseURL + nombre + ext;
    location = url;
    }

    </script>
    [/code]

    [code=html]
    <form name="form1" id="form1" method="post" action="" >
    <p style="width: 361px">
    Company Name <input name="nombre" type="text" id="nombre" value="" style="width: 184px"><br>

    <p style="width: 365px; height: 44px;">
    <input name="button" type="button" id="button" value="Click here to get Financials" onclick="makeUR L()" style="width: 185px" >
    </form>[/code]
    Last edited by Frinavale; Jan 20 '09, 07:49 PM. Reason: added [code] tags
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    probably window.location .href is what you're looking for.

    Comment

    • twiersum
      New Member
      • Jan 2009
      • 2

      #3
      Anyone else......I need to make this work?

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Check the key code onkeypress. Enter is 13.

        Comment

        Working...