37 users online (1 members and 36 guests)  


  Results 1 to 6 of 6

Related

  1. open url from text box? pls help    Forum: Javascript Forum
    Replies: 69
  2. Replies: 0
  3. open url from text box    Forum: Javascript Forum
    Replies: 1
  4. how to open save/open dialog using HTML    Forum: HTML Forum
    Replies: 1
  1. #1
    carpediem1's Avatar
    New User

    Status
    Offline
    Join Date
    Jun 2007
    Posts
    2

    Smile open url from text box

    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 studentcity, like ´newyork´, then presses ´ok´ en the page newyork.htm will load. Is there a simple way to do this?

  2. #2
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732

    Re: open url from text box

    Hi there carpediem1,

    and a warm welcome to these forums.

    Instead of asking your colleagues to type in their city, use a select element with the options already provided, as in this example...
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    <style type="text/css">
    
    </style>
    
    <script type="text/javascript">
       var df;
    window.onload=function() {
       df=document.forms[0];
    df[1].onclick=function() {
       goThere();
      }
     }
    function goThere() {
    if(df[0].value!='') {
       temp=df[0].value;
       df.reset();
       location.href=temp;
      }
     }
    </script>
    
    </head>
    <body>
    
    <form action="#">
    <div>
    <select>
    <option value="" >---options---</option>
    <option value="http://www.google.com">google</option>
    <option value="http://www.ahfb2000.com/">webmaster forums</option>
    <option value="http://www.w3schools.com">w3schools</option>
    </select>
    <input type="button" value="ok"/>
    </div>
    </form>
    
    </body>
    </html>

  3. #3
    carpediem1's Avatar
    New User

    Status
    Offline
    Join Date
    Jun 2007
    Posts
    2

    Thumbs up Re: open url from text box


    Great, it works, a lot of thanks

    you are a great friend !

  4. #4
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732

    Re: open url from text box

    No problem, you're very welcome.

  5. #5
    mijako's Avatar
    New User

    Status
    Offline
    Join Date
    Jun 2007
    Posts
    2

    Re: open url from text box

    Hi from another forum newbie.

    I'm looking to do the same thing as carpediem1, but the user choices are far too many to put in a dropdown list or list box. Can this be done the way carpe asked?
    Basically, I'd likethe user to enter a 1- or 2-digit number into a textbox, then press [Enter] and have the url with that digit (e.g., 27.html) loaded.

    Possible?

  6. #6
    mijako's Avatar
    New User

    Status
    Offline
    Join Date
    Jun 2007
    Posts
    2

    Thumbs up Re: open url from text box

    Oop.. never mind. I found the solution on another page. (Sorry -- not enough posts to be able to put the link here, but it's thread 6028.)
    Thanks!!



Tags for this Thread