Find jobs - Debt Consolidation - Debt Consolidation - Free Advertising - Online Advertising

PDA

View Full Version : JS LINK: URL + VARIABLE - please help


flym4zt3r
Jan 27th 2008, 9:05 am
Hi. Sorry if this has already been answered but I can't find it and the search function doesn't work with the word 'url'.

I've been searching for quite a while now, and can't figure this out, though I believe the answe is fairly simple.

What I need to do is this:

Text form in an html page. Visitor writes something there and when he clicks the go/submit button, the page goes to a predefined url + the given variable. Something like:

...

var myvar = anything;

...

textbox input = anything

when submit button clicked:

some_function( 'http://www.site.com' + myvar );

something like: http://www.site.com/userdata


Thank you and sorry for my bad english.

MMJ
Jan 27th 2008, 10:15 am
<form action="http://www.site.com/" onsubmit="location = this.action + this.myvar"><input type="text" name="myvar" /></form>

flym4zt3r
Jan 27th 2008, 10:45 am
Kewl. Thanks a lot. This has solved one of my problems. Thank you, thank you, thank you, thank you. :D

This wasn't really what I needed but it solved one of my probs. :) This solution gives the following result:

mysite.com/?myvar=text-entered-by-user

I edited the name and one it's done.
But I still need to know if javascript can do this:

mysite.com/text-entered-by-user - without any other specs.

Anyway, thankx a lot, MMJ.

MMJ
Jan 27th 2008, 11:12 am
Oops!

<form action="http://www.site.com/" onsubmit="location = this.action + this.myvar.value; return false"><input type="text" name="myvar" /></form>

flym4zt3r
Jan 27th 2008, 11:15 am
Thanks a lot! That's it! :D Thank you. :)