Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Apr 2004
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    A wierd script I need.

    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

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Code:
    <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.

  • #3
    New Coder
    Join Date
    Apr 2004
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    Last edited by AirGuitar; 06-22-2004 at 05:24 PM.

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Replace the "location.hostname" in the script with the appropriate hostname literal.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #5
    New Coder
    Join Date
    Apr 2004
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmm, doesnt work...

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by AirGuitar
    Hmm, doesnt work...
    Show the code you're using. We know what we intended but without seeing what you're actually running...
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #7
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Does your code look like this?
    Code:
    <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>
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #8
    New Coder
    Join Date
    Apr 2004
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nah, It's ok now, I found something suiting my needs on a javascript site, thanks for help tho


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •