Video Disclaimer

From NCSC Wiki
(Difference between revisions)
Jump to: navigation, search
 
(17 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 = "Video_Library";
+
     location.href = "Professional_and_Parent_Resources";
 +
}
 +
 
 +
function generate()
 +
{
 +
    //Set up addition line
 +
    x = Math.floor((Math.random() * 5) + 1);
 +
    y = Math.floor((Math.random() * 5) + 1);
 +
    document.getElementById("z").innerHTML = "What is: " + String(x) + " + " + String(y) + " = ";
 +
}
 +
 
 +
function submit()
 +
{
 +
    clearErrors();
 +
    var valid = 0; //when valid equals 3 then all fields have passed.
 +
   
 +
    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 clearErrors()
 +
{
 +
    document.getElementById("firstnameError").innerHTML = "";
 +
document.getElementById("lastnameError").innerHTML = "";
 +
document.getElementById("emailError").innerHTML = "";
 +
document.getElementById("sumError").innerHTML = "";
 +
}
 +
 
 +
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>
<h2>Terms of Use</h2>
+
<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>
 +
<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>
 
<p>
The professional development materials linked to the NCSC WIKI are for available for online viewing and individual use only. Other uses are prohibited.
+
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.  
I agree to the terms of Use on the NCSC professional development website.
+
<br>
 
</p>
 
</p>
<button onclick="set_cookie()">Accept</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