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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Search bar - link form

    Hey
    I'm a newbie to the art of coding but I want to code a form box into a search box type thing. The closest I've found to the link box I want is this:
    <form action="#">
    Type in a URL, and hit the Go! button to go there!
    <br />
    <input name="the_url" type="text" value="http://" size="25" />
    &nbsp;&nbsp;
    <input type="button" value="Go!" onClick="window.location=this.form.the_url.value" />
    </form>


    What I want my search bar/link bar is that when you type in say "joe" i want it to go to page ../joe.htm (I'm using microsoft frontpage btw). Is there anyway I can code that somehow? Any help would be great. Thank you in advance !

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>&nbsp;</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <script type="text/javascript">
    function searchIt()
    {
    var yoursite = 'http://www.yoursite.com/';
    var suffix = '.htm';
    window.location = yoursite + document.forms[0].goto.value + suffix;
    return false;
    }
    </script>
    </head>
    <body>
    <form action="#" method="post" onsubmit="return searchIt()">
    <input type="text" name="goto" value="Enter Page Name Here" onfocus="if(this.value == this.defaultValue) this.value = ''" onblur="if(this.value == '') this.value = this.defaultValue">
    <input type="submit" value="Submit">
    </form>
    </body>
    </html>
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

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