Please help - URL based on textbox

F

forbin27

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
 
R

Randy Webb

(e-mail address removed) 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
 
A

ASM

(e-mail address removed) 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>
 
F

forbin27

(e-mail address removed) 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:
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>


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

Thanx
Craig
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top