View Full Version : A wierd script I need.
AirGuitar
06-22-2004, 08:26 AM
Hi, I was wondering if theres a way that I can get a script where the viwer of my site can enter the last section of a URL into a form, hit go, and...go to it :)
E.G
somebody enters bobby into the text box, and hit's go: It will take them to www.mysite.com/bobby
somebody enters chipfry.html : takes them to www.mysite.com/chipfry.html
Help would be greatly appriciated
Air
<form action="javascript://" onsubmit="location.href = location.protocol + '//' + location.hostname + '/' + this.elements[0].value; return false;">
<input type="text" value="index.html"/><input type="submit"/>
</form>
Would be more accessible to use a PHP script or something server-side, but this suffices for client-side.
AirGuitar
06-22-2004, 04:11 PM
I'll try that, but If I can get a php, that's great.
Edit: I tried it, it's alng the lines of what I need, but not quiet.
I need it to go to a different server.com/whateva not the CURRENT ONE.
at the moment it goes to www.free.hostultra.com/inputedword
I need it to go to www.myotherwebhost.com/inputedword
Php, SSI, anythin is fine.
:thumbsup:
Roy Sinclair
06-22-2004, 04:37 PM
Replace the "location.hostname" in the script with the appropriate hostname literal.
AirGuitar
06-22-2004, 07:46 PM
Hmm, doesnt work...
Roy Sinclair
06-22-2004, 09:19 PM
Hmm, doesnt work...
Show the code you're using. We know what we intended but without seeing what you're actually running...
glenngv
06-23-2004, 06:51 AM
Does your code look like this?
<form action="javascript://" onsubmit="location.href='http://www.myotherwebhost.com/' + this.elements[0].value; return false;">
<input type="text" value="index.html" />
<input type="submit" />
</form>
AirGuitar
06-23-2004, 05:12 PM
Nah, It's ok now, I found something suiting my needs on a javascript site, thanks for help tho :D
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.