1-2 Web Programming lab6




Basic temperature is like this.

<!DOCTYPE html>
<html>
<head>


<form name="firstnameform" onsubmit="return validationFrom()" method="post">


</head>
</body>
</html>

Then I can materialize structures and design by html & CSS

For the main purpose of lab6 in Web Programming is getting used to JavaScript.
JavaScript begins with <script> and ends with </script>

To complete this lab, I had to use onload event which execute methods.


event syntax

object.onload = function() { script }


The example of onload event with sub event (onsubmit)


window.onload = function() {
    document.getElementById("id").onsubmit = function() {
        validationFrom();
   }
}


Each function --

function checkFilled() {
   var x = document.forms["A"]["B"] .value;
   if (x == "") {alert("Name must be filled out");
   return false;
} elase {
   return true;
}
}


To check validation

function validateForm() {
   if (method1()!=true || method2()!=true || method3()!=true){
       return false;
   } else { alert(" ---- ");
   return true;
  }
}








Comments

Popular Posts