Results 1 to 6 of 6

Thread: javascript form

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715

    javascript form

    this shouldn't be too hard, but I want to have a textbox, and a button and when someone clicks that button, i want it to goto /files/(number in textbox).htm

    how can I do this


    thanks,

    Dimava
    NXSupport - Your one-stop source for computer help

  2. #2
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    Check to see if window.navigate() is part of the standards. If so, you can build the URL (myURL = "http://www.mydomain.com/mysite/files/" + document.myForm.myTextInput.Value + ".html";) and pass it on. Might want to validate the input first.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    I have this:

    Code:
            <input type="text" name="textfield2" size="5" maxlength="3">
            <input type="submit" name="Download2" value="Download">
    what do I do next? (i dont have a form)

    thanks

    Dimava
    NXSupport - Your one-stop source for computer help

  4. #4
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    Out of practice, I always put input elements in a form. But, I guess you don't have to. It just gets a little stickier when you want to reffer to the input element by ID.

    Some key words to look up regarding HTML/DOM/JavaScript.

    document.getElementByID()
    the onClick attribute
    window.navigate()
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    I coudln't really find anything that would help me out
    NXSupport - Your one-stop source for computer help

  6. #6
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    hi

    First of all - enclose all elements like buttons,textboxes,textarea be enclosed in forms - otherwise I think it will not work in NetScape.


    Code:
    <script language="javascript">
    function CallPage(theform)
    {
    mstr = "/files/" + theform.textfield2.value + ".htm";
    
    window.location.href = mstr;
    }
    </script>
    <form name=myform>
    <input type="text" name="textfield2" size="5" maxlength="3">
    <input type="button" name="Download2" value="Download" onclick="CallPage(document.myform);">
    
    </form>

    Thats 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
  •  



Click Here to Expand Forum to Full Width