By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,672 Members | 1,292 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,672 IT Pros & Developers. It's quick & easy.

Please help - URL based on textbox

P: n/a
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 '07 #1
Share this Question
Share on Google+
3 Replies

P: n/a
fo******@gmail.com 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/
Feb 15 '07 #2

P: n/a
ASM
fo******@gmail.com 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é
Feb 15 '07 #3

P: n/a
On Feb 15, 3:21 am, ASM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
forbi...@gmail.com 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 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.