Please help - URL based on textbox

Discussion in 'Javascript' started by forbin27@gmail.com, Feb 15, 2007.

  1. Guest

    Need help - I'm new to javascript. I need to create a URL based on a
    textbox.

    Idea is user enters a number into a text box then clicks button which
    retrieves a link based on the number previously entered in the
    textbox. Something like:

    http://www.xyz123.com/constanttext/<number from box>/constant/

    Any ideas?

    Thanx,
    Craig
    , Feb 15, 2007
    #1
    1. Advertising

  2. Randy Webb Guest

    said the following on 2/14/2007 9:47 PM:
    > Need help - I'm new to javascript. I need to create a URL based on a
    > textbox.
    >
    > Idea is user enters a number into a text box then clicks button which
    > retrieves a link based on the number previously entered in the
    > textbox. Something like:
    >
    > http://www.xyz123.com/constanttext/<number from box>/constant/
    >
    > Any ideas?


    Lots of ideas. Some not fit to post in a family oriented group.

    beginningOfURL = http://www.xyz123.com/constanttext/'
    middleOfURL = document.forms['formID'].elements['textBoxNAME'].value
    endOfURL = '/constant/'
    completeURL = beginningOfURL + middleOfURL + endOfURL

    document.location.href=completeURL
    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
    Randy Webb, Feb 15, 2007
    #2
    1. Advertising

  3. ASM Guest

    a écrit :
    > Need help - I'm new to javascript. I need to create a URL based on a
    > textbox.
    >
    > Idea is user enters a number into a text box then clicks button which
    > retrieves a link based on the number previously entered in the
    > textbox. Something like:
    >
    > http://www.xyz123.com/constanttext/<number from box>/constant/
    >
    > Any ideas?


    How user could know which numbers are available ?

    <select onchange="var k = this.options.selectedIndex;
    if(k==0) {alert('choice in list');return}
    location.href='http://www.xyz123.com/constanttext/'+
    this.options[k].value+'/constant/';">
    <option>Find next</option>
    <option value="1">1</option>
    <option value="214">2</option>
    <option value="48">3</option>
    </select>

    With an input :

    <input onchange="location.href='http://www.xyz123.com/constanttext/'+
    this.value+'/constant/';">
    <input name="false_button" type=button value="go">

    or :

    <form action="http://www.xyz123.com/constanttext/"
    onsubmit="this.action += this.number.value + '/constant/';">
    Enter a number here: <input name="number" type=text>
    <input type=submit value="go">
    </form>

    --
    Stephane Moriaux et son (moins) vieux Mac déjà dépassé
    ASM, Feb 15, 2007
    #3
  4. Guest

    On Feb 15, 3:21 am, ASM <>
    wrote:
    > a écrit :
    >
    > > Need help - I'm new to javascript. I need to create a URL based on a
    > > textbox.

    >
    > > Idea is user enters a number into a text box then clicks button which
    > > retrieves a link based on the number previously entered in the
    > > textbox. Something like:

    >
    > >http://www.xyz123.com/constanttext/<number from box>/constant/

    >
    > > Any ideas?

    >
    > How user could know which numbers are available ?
    >
    > <select onchange="var k = this.options.selectedIndex;
    > if(k==0) {alert('choice in list');return}
    > location.href='http://www.xyz123.com/constanttext/'+
    > this.options[k].value+'/constant/';">
    > <option>Find next</option>
    > <option value="1">1</option>
    > <option value="214">2</option>
    > <option value="48">3</option>
    > </select>
    >
    > With an input :
    >
    > <input onchange="location.href='http://www.xyz123.com/constanttext/'+
    > this.value+'/constant/';">
    > <input name="false_button" type=button value="go">
    >
    > or :
    >
    > <form action="http://www.xyz123.com/constanttext/"
    > onsubmit="this.action += this.number.value + '/constant/';">
    > Enter a number here: <input name="number" type=text>
    > <input type=submit value="go">
    > </form>
    >
    > --
    > Stephane Moriaux et son (moins) vieux Mac déjà dépassé



    Thank you both very much - your help got me past the problem Works
    fine.

    Thanx
    Craig
    , Feb 16, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JC
    Replies:
    4
    Views:
    7,946
    Jeff C
    Jul 8, 2004
  2. Jon paugh
    Replies:
    1
    Views:
    677
  3. Replies:
    4
    Views:
    489
    Chris Uppal
    May 5, 2005
  4. KK
    Replies:
    2
    Views:
    510
    Big Brian
    Oct 14, 2003
  5. Just D.
    Replies:
    0
    Views:
    396
    Just D.
    Aug 11, 2004
Loading...

Share This Page