1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need help with a simple script.

Discussion in 'HTML & JavaScript' started by Antwan, Apr 10, 2012.

  1. Antwan

    Antwan Newbie

    Joined:
    Sep 9, 2010
    Messages:
    18
    Likes Received:
    0
    Hello, I need help developing a simple redirection link.

    What I need basically is when the visitor is on the page domain, to be able to type in something, for example "text" and click a button and be redirected to domain/text

    Thanks in advance :)

    (not sure if im posting in the right place and if this can be done with HTML/JavaScript)
     
  2. Vinzen

    Vinzen Newbie

    Joined:
    Apr 1, 2012
    Messages:
    43
    Likes Received:
    22
    Put this in your head

    Code:
    <SCRIPT type="text/javascript">
    function goToPage(url)
    {
    var initial = "ht8t*p://w*ww.si*te/-p-";
    var extension = ".html";
    
    document.something.action=initial+url+extension;
    }
    </SCRIPT>
    <TITLE>Redirect 1</TITLE>
    <BASE HREF="h*t*t*p://w*w*w.site.C*o*m/">
    This in your body

    Code:
    <FORM name="something" method="post" onsubmit="goToPage(this.url.value);">
    Label
    <INPUT type="text" name="url" value="">
    <INPUT type="submit" value="GO">
    </FORM>
    Because the BHW post system is way to strict, I you have to remove the * in the links.