Video Disclaimer

From NCSC Wiki
(Difference between revisions)
Jump to: navigation, search
Line 8: Line 8:
 
     document.cookie = "ncsc_disclaimer_agreed=1;";
 
     document.cookie = "ncsc_disclaimer_agreed=1;";
 
     location.href = "Professional_and_Parent_Resources";
 
     location.href = "Professional_and_Parent_Resources";
 +
}
 +
 +
 +
var sum = document.getElementById("sum").value;
 +
var firstname = document.getElementById("firstnameInput").value;
 +
var lastname = document.getElementById("lastnameInput").value;
 +
var email = document.getElementById("emailInput").value;
 +
 +
function generate(){
 +
var x = Math.floor((Math.random() * 5) + 1);
 +
var y = Math.floor((Math.random() * 5) + 1);
 +
 +
document.getElementById("z").innerHTML = "What is: " + String(x) + " + " + String(y) + " = ";
 +
document.getElementById("z").name = (x+y).toString();
 +
}
 +
 +
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 if(document.getElementById("lastnameInput").value == "")
 +
{
 +
    document.getElementById("lastnameError").innerHTML = " Please enter your last name.";
 +
}
 +
else
 +
{
 +
    valid++;
 +
}
 +
   
 +
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++;
 +
}   
 +
   
 +
sum = document.getElementById("sum").value;
 +
if(sum==document.getElementById("z").name){
 +
    valid++;
 +
//everything is good call php
 +
}
 +
else{
 +
generate();
 +
document.getElementById("sumError").innerHTML = " Wrong! Try again.";
 +
}
 +
   
 +
if(valid == 3)
 +
{
 +
sum = document.getElementById("sum").value;
 +
firstname = document.getElementById("firstnameInput").value;
 +
lastname = document.getElementById("lastnameInput").value;
 +
email = document.getElementById("emailInput").value;
 +
send_data();
 +
}   
 +
   
 +
}//end of submit()
 +
function clearErrors(){
 +
document.getElementById("emailError").innerHTML = "";
 +
document.getElementById("sumError").innerHTML = "";
 +
}
 +
function send_data()
 +
{
 +
    $.post("https://wiki.ncscpartners.org/process_data.php",
 +
    {
 +
      'firstname': firstname,
 +
      'lastname': lastname,
 +
      'email': email
 +
    },
 +
      //location.href = "Professional_and_Parent_Resources"
 +
      //alert("hello")
 +
      set_cookie();
 +
    );
 +
   
 
}
 
}
 
</script>  
 
</script>  

Revision as of 12:56, 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.



Powerpoint presentations with speaker notes are available for download with each presentation.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox