Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Problem with my JavaScript or JSP?

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Location
    Malaysia
    Posts
    6
    My Mood
    Hungover
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Problem with my JavaScript or JSP?

    function formSubmit(){
                    var length;
                    var d = document.Example;
     
                    length = d.userName.value.length();
     
                    if(length < 1){
                        alert("Please Key in UserID");
                        d.userName.focus();
                        return false;
                    }
     
                    length = d.userPassword.value.length();
     
                    if (length <1){
                        alert("Please Key in Password");
                        d.userPassword.focus();
                        return false;
                    }
     
     
                }

    <table>
        <tr>
            <td><input Name="userName" size="10" maxlength="20" type ="text"  onkeypress="checkKeyPress();" onBlur="UpperCase(this);"></td>
     
        </tr>
        <tr>
            <td><input name="userPassword" type="password" size="20" maxlength="20" onkeypress="checkKeyPress();" ></td>
            <td><div><img src="images/iconlogon.gif" onClick="formSubmit();" style=cursor:hand;></div></td>
        </tr>
     
            </table>

    y cant i click it and it is not function?

    anybody can give me some guide?


  2. #2
    Junior Member
    Join Date
    Sep 2011
    Location
    Malaysia
    Posts
    6
    My Mood
    Hungover
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Problem with my JavaScript or JSP?

    I solve already =D but it kind of weird. I put Try & Catch in length = d.userName.value.length(); and then i remove Try & Catch and it can run properly already =.=" anyone can tell me what is happening??

Similar Threads

  1. Problem in a web that uses javascript in his login form
    By kamarilla in forum What's Wrong With My Code?
    Replies: 8
    Last Post: June 1st, 2011, 05:47 PM
  2. javascript:void(0
    By serenafare1 in forum Member Introductions
    Replies: 1
    Last Post: April 12th, 2011, 08:44 PM
  3. JAVASCRIPT DATE DIFFERENCE PROBLEM
    By jai in forum Other Programming Languages
    Replies: 3
    Last Post: April 5th, 2011, 09:11 AM
  4. javascript problem
    By kundan_101 in forum Member Introductions
    Replies: 2
    Last Post: December 30th, 2010, 08:02 AM
  5. How can i put session in Javascript?
    By rajani in forum JavaServer Pages: JSP & JSTL
    Replies: 2
    Last Post: July 8th, 2009, 12:46 PM