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 GDB 2018 Bia Fatima 1 1,597 08-02-2018, 08:05 AM
Last Post: Admin
  CS101 Assignment 3 Solution Spring 2018 Mehar Hasnain Awan 0 413 07-16-2018, 10:00 PM
Last Post: Mehar Hasnain Awan
  CS101 Assignment Solution Spring 2018 Admin 3 2,872 05-26-2018, 07:48 PM
Last Post: Syed Saif Ul Ejaz
  CS101 Quiz 2 Syed Azhar Hussain Bukhari 2 1,159 01-23-2018, 11:33 AM
Last Post: Admin
  CS101 Assignment 1 Solution Fall 2017 Pakistani 9 5,839 11-06-2017, 06:28 PM
Last Post: muhammadhamza2222
  CS101 Assignment 3 Solution Admin 2 4,027 07-08-2017, 08:07 PM
Last Post: Admin
  CS101 assignment solution Rubaisha(Moody Girl) 0 1,037 07-31-2016, 06:17 PM
Last Post: Rubaisha(Moody Girl)
  Cs101 solution Rubaisha(Moody Girl) 0 1,021 05-08-2016, 10:20 PM
Last Post: Rubaisha(Moody Girl)



Users browsing this thread:
1 Guest(s)