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
  CS101 Assignment 2 Solution Spring 2020 Ayra Suleman 0 187 06-11-2020, 06:28 AM
Last Post: Ayra Suleman
  CS101 GDB Solution Fall 2020 Ayra Suleman 0 1,976 01-31-2020, 08:19 PM
Last Post: Ayra Suleman
  CS101 GDB Solution Mishi Khan 1 2,569 01-25-2020, 04:59 PM
Last Post: adsvoo
  CS101 Assignment 1 Solution Fall 2019 Ayra Suleman 0 1,078 11-11-2019, 02:02 AM
Last Post: Ayra Suleman
  CS001 GDB Solution Spring 2019 Ayra Suleman 0 1,662 08-05-2019, 03:44 AM
Last Post: Ayra Suleman
  CS101 GDB Solution Spring 2019 Ayra Suleman 0 1,594 08-05-2019, 03:42 AM
Last Post: Ayra Suleman
  IT430 GDB Solution Spring 2019 Ayra Suleman 0 408 08-05-2019, 03:41 AM
Last Post: Ayra Suleman
  CS001 Assignment Solution Spring 2019 Mishi Khan 0 917 06-01-2019, 01:17 AM
Last Post: Mishi Khan
  IT430 Assignment Solution Spring 2019 Mishi Khan 0 599 05-31-2019, 01:45 AM
Last Post: Mishi Khan
  CS311 Assignment 2 Solution Spring 2019 Mishi Khan 0 900 05-23-2019, 03:22 AM
Last Post: Mishi Khan



Users browsing this thread:
1 Guest(s)