Results 1 to 6 of 6

Thread: Describe how this HTML code produces the form displayed in the browser?

  1. #1
    Join Date
    Mar 2014
    Beans
    3

    Describe how this HTML code produces the form displayed in the browser?

    Describe how this HTML code below produces the form displayed in the browser? Any Ideas?
    Thanks
    Jacob

    <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(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><input type=”submit” name=”Submit” value=”Submit” onclick=”return validateForm();” /></td>
    <td><input type=”reset” name=”Reset” value=”Reset” /></td>
    </tr>

    </table>
    </form>
    </body>

  2. #2
    Join Date
    Mar 2014
    Beans
    3

    Describe how the JavaScript function performs the validation check?

    Describe how the JavaScript function below performs the validation check? Any Ideas?
    Thanks Jacob
    <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(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><input type=”submit” name=”Submit” value=”Submit” onclick=”return validateForm();” /></td>
    <td><input type=”reset” name=”Reset” value=”Reset” /></td>
    </tr>

    </table>
    </form>
    </body>

  3. #3
    Join Date
    Aug 2011
    Location
    47°9′S 126°43W
    Beans
    2,163
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Describe how the JavaScript function performs the validation check?

    Is this cheating on homework/exam?
    Warning: unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.

  4. #4
    Join Date
    Aug 2011
    Location
    47°9′S 126°43W
    Beans
    2,163
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Describe how this HTML code produces the form displayed in the browser?

    Is this cheating on homework/exam?
    Warning: unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.

  5. #5
    Join Date
    May 2007
    Location
    The New Forest
    Beans
    Hidden!
    Distro
    Xubuntu

    Re: Describe how the JavaScript function performs the validation check?

    While we are happy to serve as a resource for hints and for asking questions when you get stuck and need a little help, the Ubuntu Forums is not a homework service. Please do not post your homework assignments expecting someone else to do it for you.
    Closed.

    When you need hints only - let me know and I will open it again.

  6. #6
    Join Date
    Sep 2006
    Location
    France.
    Beans
    Hidden!
    Distro
    Ubuntu Mate 15.10 Wily Werewolf

    Re: Describe how this HTML code produces the form displayed in the browser?

    Sorry to post in a closed thread. The dup thread has been merged in.
    | My old and mostly abandoned blog |
    Linux user #413984 ; Ubuntu user #178
    J'aime les fraises.
    Nighty night me lovelies!

    | Reinstalling Ubuntu ? Please check this bug first ! |
    | Using a ppa ? Please install ppa-purge from universe, you may need it should you want to revert packages back |
    | No support requests / username changes by PM, thanks. |

Tags for this Thread

Bookmarks

Posting Permissions

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