Go to web address javascript html

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • flyguyes
    New Member
    • Oct 2005
    • 1

    Go to web address javascript html

    HI all Im new to this so forgive my ignorance. so here goes my question I've been researching for a while but havent found what i need.
    What Im need is a javascript that will make a form box that the visitor can put a web address in and when they hit the submit button it will take them to the website they entered. the closes i got is this:

    <form name='site'>
    <input type='text' name='url'/>
    <input type='submit' value='Go!' onclick="window .theframe.locat ion=document.si te.url.value"/>
    </form>

    but when i try it the addres bar does say "url=www.google .com" but nothing happens. I know im doing somethin wrong i jus was hoping someone out there could help me with that. I can write a script that will take someone to a predetermined website when they hit the button:

    <script type="text/javascript">
    function locate()
    {
    location="http://www.google.com/"
    }
    </script>

    </head>
    <body>

    <form>
    <input type="button" onclick="locate ()" value="New location">
    </form>

    </body>

    but i am looking for a way where the visitor can choose......now here the catch what i really need is to combine these two concepts so that what the visitor sees it just the form box and the button but what going on in the backround is www.google.com/[ form box here] [go btn] so when they put in lets say "services" it will take what in the script and add /services to the address so they will get pointed to www.google.com/services. so thats what i needed help with. I would really be truly grateful for any help i could get. Thanks in advance...
  • glikoz
    New Member
    • Aug 2006
    • 3

    #2
    The correct form of your code is:

    <form name='site'>
    <input type='text' name='url'/>
    <input type='button ' value='Go!' onclick="window .location=docum ent.site.url.va lue"/>
    </form>

    Comment

    Working...