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.

1 Visitor Messages

  1. <html>
    <head>
    <title>Exam entry</title>
    <script language="javascript" type="text/javascript"> function validateForm() {
    var result = true; var msg="";

    if (document.ExamEntry.name.value=="") { msg+="You must enter your name \n"; document.ExamEntry.name.focus();
    document.getElementById('name').style.color="red"; result = false;
    }


    if (document.ExamEntry.subject.value=="") { msg+="You must enter the subject \n"; document.ExamEntry.subject.focus();
    document.getElementById('subject').style.color="re d"; result = false;
    }

    if (document.ExamEntry.subject.value=="") { msg+="You must enter your examination number \n"; document.ExamEntry.subject.focus();
    document.getElementById('number').style.color="red "; result = false;
    }

    if(msg==""){ return result;
    }

    {
    alert(msg) return result;
    }
    }

    </script>
    </head>

    <body>
    <h1>Exam Entry Form</h1>
    <form name="ExamEntry" method="post" action="success.html">
    <table width="50%" border="0">
    <tr>
    <td id="name">Name</td>
    <td><input type="text" name="name" /></td>
    </tr>
    <tr>
    <td id="subject">Subject</td>
    <td><input type="text" name="subject" /></td>
    </tr>
    <tr>
    <td id="number">Examination Number</td>
    <td><input type="number" name="number" /></td>
    </tr>

    <tr>
    <td><input type="submit" name="Submit" value="Submit" onclick="return validateForm();" /></td>
    <td><input type="reset" name="Reset" value="Reset" /></td>
    </tr>

    </table>
    </form>
    </body>
    </html>
    I'm trying to make a message come up if the box is left bank... What have I done wrong? TTmTT
Showing Visitor Messages 1 to 1 of 1
About Kkbob

Basic Information

About Kkbob
Java Skill Level:
Beginner

Statistics


Total Posts
Total Posts
2
Posts Per Day
0.00
Visitor Messages
Total Messages
1
Most Recent Message
September 29th, 2014 05:25 AM
Total Thanks
Total Thanks
0
  • Thanked 0 Times in 0 Posts
General Information
Last Activity
September 29th, 2014 06:34 AM
Join Date
September 29th, 2014