CS101 Assignment 2 Solution Spring 2018
#1
CS101 Assignment 2
Spring 2018

Solution
Code:
<!DOCTYPE html>
<html>
<head>
    <title>Assignment 2</title>
    <script type="text/javascript">
        function showMessage(){
            alert(document.getElementsByName('program')[0].value);
        }
        function CheckForm(){
            var isValid=true;
            var password = document.getElementsByName('password')[0].value;
            var rePassword = document.getElementsByName('repassword')[0].value;
            if(password.length ==0 || rePassword.length==0) {
                isValid=false;
                alert("One of the two password fields is empty");
            } else {
                if(password != rePassword){
                    isValid=false;
                    alert("Password and Match password are not same !!");
                } else {
                    alert("Password and Match password are same !!");
                }
                if(isValid) {
                    alert("Congratulations, you have successfully registered");
                }
            }
        }

    </script>
    <style type="text/css">
        h1{
            text-align: center;
            font-size: 40px;
        }
        form {
            position: relative;
            margin: 30px auto;
            width: 500px;
            border: 3px solid #1eb6ff;
           padding: 5px;
        }
        form:before {
            content: " ";
            position: absolute;
            z-index: -1;
            top: 3px;
            left: 3px;
            right: 3px;
            bottom: 2px;
            border: 5px solid #000;
        }
        table {
           margin: 0 auto;
           z-index: 1;
           width:55%;
           height: 50px;
        }
    </style>
</head>
<body>
    <form name="myinfo" method="post">
        <h1>VU Signup Form</h1>
        <br/>
        <br/>
        <table>
            <tr>
                <td>Name</td>
                <td><input type="text" name="name" value="Ata Ur Rehman" /></td>
            </tr>
            <tr>
                <td>Father Name</td>
                <td><input type="text" name="fname" value="Hussain Ahmed" /></td>
            </tr>
            <tr>
                <td>Gender:</td>
            </tr>
            <tr>
                <td>Male</td>
                <td><input type="radio" name="gender" value="male" checked="checked"></td>
            </tr>
            <tr>
                <td>Female</td>
                <td><input type="radio" name="gender" value="fmale"></td>
            </tr>
            <tr>
                <td>Date of Birth</td>
                <td><input type="text" value="21/10/1991" name="dob"></td>
            </tr>
            <tr>
                <td>Study program</td>
                <td>
                    <select onchange="showMessage();" name="program">
                        <option value="CS">CS</option>
                        <option value="Accounting">Accounting</option>
                        <option value="Zoology" selected="true">Zoology</option>
                        <option value="HRM">HRM</option>
                        <option value="Mathematics">Mathematics</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>Comments:</td>
                <td><textarea rows="10" cols="20">Write something about you here…</textarea></td>
            </tr>
            <tr>
                <td>Email:</td>
                <td><input type="email" name="email" value="abc@gmail.com"/></td>
            </tr>
            <tr>
                <td>Password:</td>
                <td><input type="password" name="password" /></td>
            </tr>
            <tr>
                <td>Confirm Password:</td>
                <td><input type="password" name="repassword"/></td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <input type="submit" name="submit" value="Sign Up" onclick="CheckForm();" />
                    <input type="reset" name="reset" value="Reset" />
                </td>
            </tr>
        </table>
    </form>
</body>
</html>

Copy this code in notepad and save as file.html and open the file in browser to see the result. Then change the personal details such as name, date of birth, gender, program etc according to yours and finally submit the code in word file. 

Good luck!
#2
ohhhh thanks
#3
(05-28-2018, 08:58 PM)Muhammad Yaseen Wrote: ohhhh thanks

You're welcome.

Good luck!
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  CS001 Assignment Solution Spring 2019 Mishi Khan 0 232 06-01-2019, 01:17 AM
Last Post: Mishi Khan
  IT430 Assignment Solution Spring 2019 Mishi Khan 0 153 05-31-2019, 01:45 AM
Last Post: Mishi Khan
  CS311 Assignment 2 Solution Spring 2019 Mishi Khan 0 152 05-23-2019, 03:22 AM
Last Post: Mishi Khan
  CS101 Assignment 2 Solution Spring 2019 Mishi Khan 0 182 05-23-2019, 03:03 AM
Last Post: Mishi Khan
  IT430 Assignment Idea Solution Spring 2019 Mishi Khan 0 177 05-14-2019, 12:25 AM
Last Post: Mishi Khan
  CS001 Assignment Solution Spring 2019 Mishi Khan 0 188 05-11-2019, 10:20 PM
Last Post: Mishi Khan
  CS101 Assignment Solution Spring 2019 Mishi Khan 0 106 05-11-2019, 09:28 PM
Last Post: Mishi Khan
  CS101 Assignment Spring 2019 Mishi Khan 0 126 05-09-2019, 09:20 PM
Last Post: Mishi Khan
  CS101 GDB Solution Mishi Khan 0 1,024 02-05-2019, 11:27 PM
Last Post: Mishi Khan
  Cs101 GDB 2018 Bia Fatima 3 3,778 01-27-2019, 11:57 AM
Last Post: Admin



Users browsing this thread:
1 Guest(s)