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

    I'm a newbie...please!"

    Why this code won't work? I get an error on the .forms[0]

    function avanza(next){
    if (event.keyCode == "9" ||event.keyCode == "16" || event.shiftKey ){
    return false;
    }
    else
    {
    if ( event.srcElement.value.length == event.srcElement.maxLength ) {
    document.forms[0][next].focus();
    }
    }
    }

    Thanks.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Maybe you're missing some things:

    document.forms[0].elements["next"].focus();


    Please click on the "Posting Guidelines: Read This Before You Post" link, there's good information there you obviously missed.
    Last edited by Roy Sinclair; 07-10-2003 at 10:29 PM.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #3
    Regular Coder
    Join Date
    Nov 2002
    Posts
    596
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If next is an integer (form element index), document.forms[0][next] should return an element reference correctly; the elements[] object isn't required. Without the calling HTML, don't think the problem can be analyzed properly.

  • #4
    New to the CF scene
    Join Date
    Jul 2003
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks cheesebagpipe. The problem was really on the HTML code.


  •  

    Posting Permissions

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