open url from text box? pls help

Discussion in 'JavaScript' started by jeronimo, Jul 22, 2006.

  1. #1
    Hi, I am new here and I was wondering if someone could help me out doing this:


    I want a textbox on a school webpage, a student types in his-her studentnumber, like ´7928´, then presses ´ok´ en the page 7928.htm will load.

    Is there a simple way to do this?
     
    jeronimo, Jul 22, 2006 IP
  2. giraph

    giraph Guest

    Messages:
    484
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    <html>
    <head>
    <script type="text/javascript">
    function go()
    {
    	window.location.href = document.getElementById("tStudentNumber").value + ".htm";
    }
    </script>
    </head>
    <body>
    <textarea id="tStudentNumber"></textarea>
    <input type="button" value="ok" onClick="go();" >
    </body>
    </html>
    
    Code (markup):
     
    giraph, Jul 22, 2006 IP