Video Disclaimer

From NCSC Wiki
(Difference between revisions)
Jump to: navigation, search
 
(28 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
<html>
 
<html>
 +
<head>
 
<style>
 
<style>
  
 
</style>
 
</style>
 +
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
 
<script>
 
<script>
 +
//Create random numbers
 +
var x = Math.floor((Math.random() * 5) + 1);
 +
var y = Math.floor((Math.random() * 5) + 1);
 +
 
function set_cookie()
 
function set_cookie()
 
{
 
{
 
     document.cookie = "ncsc_disclaimer_agreed=1;";
 
     document.cookie = "ncsc_disclaimer_agreed=1;";
     location.href = "Testpage2";
+
     location.href = "Professional_and_Parent_Resources";
 
}
 
}
  
function get_cookie(cname) {
+
function generate()
     var name = cname + "=";
+
{
     var ca = document.cookie.split(';');
+
     //Set up addition line
     for(var i=0; i<ca.length; i++) {
+
     x = Math.floor((Math.random() * 5) + 1);
        var c = ca[i];
+
     y = Math.floor((Math.random() * 5) + 1);
        while (c.charAt(0)==' ') c = c.substring(1);
+
    document.getElementById("z").innerHTML = "What is: " + String(x) + " + " + String(y) + " = ";  
        if (c.indexOf(name) != -1) return c.substring(name.length,c.length);
+
    }
+
    return "";
+
 
}
 
}
  
function check_cookie() {
+
function submit()
     var username=get_cookie("ncsc_disclaimer_agreed");
+
{
     alert(username);
+
    clearErrors();
     if (username=="1") {
+
     var valid = 0; //when valid equals 3 then all fields have passed.
         alert("You have agreed to the term!");
+
   
 +
    if(document.getElementById("firstnameInput").value == "")
 +
    {
 +
        document.getElementById("firstnameError").innerHTML = " Please enter your first name.";
 +
     }
 +
    else
 +
    {
 +
        valid++;
 +
    }
 +
   
 +
    if(document.getElementById("lastnameInput").value == "")
 +
    {
 +
        document.getElementById("lastnameError").innerHTML = " Please enter your last name.";
 +
    }
 +
    else
 +
    {
 +
        valid++;
 +
    }
 +
   
 +
     if(document.getElementById("sum").value == "")
 +
    {
 +
         document.getElementById("sumError").innerHTML = " Please enter the sum.";
 +
    }
 +
    else
 +
    {
 +
        valid++;
 +
    } 
 +
   
 +
    //Check email   
 +
    var emailPattern = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-z0-9-]+(\.[a-z]+)*(\.[a-z]{2,4})$/;   
 +
    var uemail = document.getElementById("emailInput");
 +
    if (emailPattern.test(uemail.value)==false)
 +
    {
 +
        var e = document.getElementById("emailError");
 +
        e.innerHTML = " Please enter email in form johndoe@yahoo.com";
 +
    }
 +
    else
 +
    {
 +
        valid++;
 +
    }   
 +
   
 +
    //Check sum
 +
    //sum = document.getElementById("sum").value;
 +
    if((x + y) == document.getElementById("sum").value)
 +
    {
 +
        valid++;
 +
    }
 +
    else
 +
    {
 +
        generate();
 +
        document.getElementById("sumError").innerHTML = " Wrong! Try again.";
 +
        document.getElementById("sum").value = "";
 
     }
 
     }
 +
   
 +
    //If all fields have passed send the data to the process script
 +
    if(valid == 5)
 +
    {
 +
        send_data();
 +
    }   
 +
   
 
}
 
}
  
function startup()
+
function clearErrors()
 
{
 
{
     alert("it got here");
+
     document.getElementById("firstnameError").innerHTML = "";
 +
document.getElementById("lastnameError").innerHTML = "";
 +
document.getElementById("emailError").innerHTML = "";
 +
document.getElementById("sumError").innerHTML = "";  
 
}
 
}
  
window.onload = startup; //Render first calculator
+
function send_data()
 +
{
 +
    var firstname = document.getElementById("firstnameInput").value;
 +
    var lastname = document.getElementById("lastnameInput").value;
 +
    var email = document.getElementById("emailInput").value;
 +
    $.post("https://wiki.ncscpartners.org/process_data.php",
 +
    {
 +
      'firstname': firstname,
 +
      'lastname': lastname,
 +
      'email': email
 +
    },
 +
      set_cookie()
 +
    ); 
 +
}
 
</script>  
 
</script>  
<body>
+
</head>
 +
<body onload="generate()">
 
<strong>To view the video library you must agree to the terms below.</strong>
 
<strong>To view the video library you must agree to the terms below.</strong>
 
<br>
 
<br>
 
<br>
 
<br>
 +
<h2>Terms of Use</h2>
 +
<p>
 +
The professional development materials linked to the NCSC WIKI are available for online viewing and individual use only. Other uses are prohibited.
 +
I agree to the terms of use on the NCSC professional development website.
 +
</p>
 +
First Name: <input type="text" id="firstnameInput" maxlength="32" size="20"><span id="firstnameError" style="color:#FF0000;"></span>
 +
<br>
 +
<br>
 +
Last Name: <input type="text" id="lastnameInput" maxlength="32" size="20"><span id="lastnameError" style="color:#FF0000;"></span>
 +
<br>
 +
<br>
 +
Email: <input type="text" id="emailInput" size="25"><span id="emailError" style="color:#FF0000;"></span><br>
 +
<br>
 +
<span id="z"></span><input type="text" id="sum" maxlength="2" size="16"><span id="sumError" style="color:#FF0000;"></span>
 +
<br>
 +
<br>
 +
<input type="button" onclick="submit()" value="I Agree">
 +
<br>
 +
<br>
 +
<p>
 +
Information collected in the video disclaimer agreement will be used for security only.  This information will not be shared or used for any other purpose.
 
<br>
 
<br>
<div id="disclaimer_container">
+
</p>
<p>I agree to not disclose any information of the follow videos.</p>
+
    <button onclick="set_cookie()">I agree</button>
+
</div>
+
 
</body>
 
</body>
 
</html>
 
</html>

Latest revision as of 14:45, 21 October 2014

To view the video library you must agree to the terms below.

Terms of Use

The professional development materials linked to the NCSC WIKI are available for online viewing and individual use only. Other uses are prohibited. I agree to the terms of use on the NCSC professional development website.

First Name:

Last Name:

Email:





Information collected in the video disclaimer agreement will be used for security only. This information will not be shared or used for any other purpose.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox