StudentCodingHUB

Use programming to create innovative things.
  • new post

    Friday, 6 December 2019

    FORWARD NOTICE




    <!DOCTYPE html>

    <html>
    <head>

    <style> 

    .container{

    border: 1px solid white;

    }
    h2{
    text-align: center;

    }

    body{

     background: #212121;

     color: white;

     margin: 0px;

      padding:20px;

    }
    button{
    position: relative;

    left: 220px;

    border-radius: 5px;

    }
    </style>
    <script> 

    function validate(){

    var a=document.getElementById("course").checked;
    var b=document.getElementById("course1").checked;
    var c=document.getElementById("course2").checked;
    var d=document.getElementById("course3").checked;
    var e=document.getElementById("course4").checked;
    var totalelements = document.forms[0].elements.length;

    if((a == "")&&(b== "")&& (c == "")&&(d == "")&&(e == "")){
     alert ("choose at least one");
    return false;
    }
    return true;
    }
    for(var i=0; i<totalelements;i++){
    var elementname = document.forms[0].elements[i].name;
    if (elementname!= undefined & elementname.indexOf("chk_")!=-1){

    document.forms[0].element[i].checked=document.frm.chk_all.checked;
    }

    }

    </script>

    </head>

    <body>
    <h2>FORWARD NOTICE</h2>

    <form name="frm" onsubmit="return validate()">

    <div>

    <input type="checkbox" name="chk_all" value="abc" id="course">Forwad To All<br>

    </div>

    <div class="container">

    <input type="checkbox" name="chk_1" value="BBA" id="course1">BBA<br>

    <input type="checkbox" name="chk_2" value="BCA"  id="course2"> BCA<br>

    <input type="checkbox" name="chk_3" value="PGDCA" id="course3">PGDCA <br>

    <input type="checkbox" name="chk_4" value="MBA" id="course4"> MBA
    </div>
    <div>
    <span><button>Forward</button></span>
    </div>
    </form>
    </body>
    </html>

    RUN CODE

    No comments:

    Post a Comment