HTML input elements + Script
https://www.upwork.com/fl/mdhanif
https://www.gulftalent.com/jobs/search#!?category=&industry=17&seniority=&country=10111112000000&city=&keyword=
Input controls are the HTML input elements:
https://www.gulftalent.com/jobs/search#!?category=&industry=17&seniority=&country=10111112000000&city=&keyword=
Input controls are the HTML input elements:
- input
elements
- select
elements
- button
elements
- textarea elements
Input Types
: text, hidden password,
radio, checkbox, button, submit, file
<input type="text" ng-model="firstname">
<input type="text" name="firstname">
<input type="checkbox" ng-model="myVar">
<input type="radio" ng-model="myVar" value="dogs">Dogs
<input type="radio" ng-model="myVar" value="tuts">Tutorials
<input type="radio" ng-model="myVar" value="tuts">Tutorials
Selectbox
<select ng-model="myVar">
<option value="">
<option value="dogs">Dogs
<option value="tuts">Tutorials
</select>
<option value="">
<option value="dogs">Dogs
<option value="tuts">Tutorials
</select>
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
</select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
</select>
<textarea ng-model="myTextarea">
</textarea>
<textarea name="message" rows="10" cols="30">
The cat was playing in the garden.
</textarea>
**************************************************************************
JavaScript variables can hold many data types: numbers, strings, arrays, objects and more:
var length = 16; // Number
var lastName = "Johnson"; // String
var cars = ["Saab", "Volvo", "BMW"]; // Array
var points = [40, 100, 1, 5, 25, 10]; // Good
var x = {firstName:"John", lastName:"Doe"};// Object
****************************************************************************
myFunction() and window.myFunction() is the same function:
</script>
The cat was playing in the garden.
</textarea>
**************************************************************************
JavaScript variables can hold many data types: numbers, strings, arrays, objects and more:
var length = 16; // Number
var lastName = "Johnson"; // String
var cars = ["Saab", "Volvo", "BMW"]; // Array
var points = [40, 100, 1, 5, 25, 10]; // Good
var x = {firstName:"John", lastName:"Doe"};// Object
****************************************************************************
function
bar() {
return
3;
}
bar()
//3
function myFunction(a, b) {
return a * b;
}
window.myFunction(10, 2);
JavaScript allows us to assign a function to a variable and then use that variable as a function. It is called function expression.
Example: Function expression
var add = function sum(val1, val2) {
return val1 + val2;
};
var result1 = add(10,20);
var result2 = sum(10,20); // not valid
JavaScript allows us to define a function without any name. This unnamed function is called anonymous function. Anonymous function must be assigned to a variable.
Example: Anonymous Function
var sayHello = function (firstName) {
alert("Hello " + firstName);
};
sayHello("Bill");
//anonymous function expression
var
a =
function
() {
return
3;
}
<script>
var x = function (a, b) {return a * b};
document.getElementById("demo").innerHTML = x(4, 3);
var myFunction = new Function("a", "b", "return a * b");
var x = myFunction(4, 3);
</script>
**************************************************************
//self invoking function expression
(
function
sayHello() {
alert(
"hello!"
);
})();
**************************************************************
function person(first, last, age, eye) {
this.firstName = first;
this.lastName = last;
this.age = age;
this.eyeColor = eye;
}
var myFather = new person("John", "Doe", 50, "blue");
var myMother = new person("Sally", "Rally", 48, "green");
document.getElementById("demo").innerHTML =
"My father is " + myFather.age + ". My mother is " + myMother.age;
// This is a function constructor:
function myFunction(arg1, arg2) {
this.firstName = arg1;
this.lastName = arg2;
}
// This creates a new object
var x = new myFunction("John","Doe");
x.firstName;
// Will return "John"
*************************************************************
var myObject = {
firstName:"John",
lastName: "Doe",
fullName: function () {
return this.firstName + " " + this.lastName;
}
}
myObject.fullName(); // Will return "John Doe"
firstName:"John",
lastName: "Doe",
fullName: function () {
return this.firstName + " " + this.lastName;
}
}
myObject.fullName(); // Will return "John Doe"
In JavaScript you can define function as object methods.
The following example creates an object (myObject), with two properties (firstName and lastName), and a method (fullName):.
// This is a function constructor:
function myFunction(arg1, arg2) {
this.firstName = arg1;
this.lastName = arg2;
}
// This creates a new object
var x = new myFunction("John","Doe");
x.firstName;
// Will return "John"
function myFunction(arg1, arg2) {
this.firstName = arg1;
this.lastName = arg2;
}
// This creates a new object
var x = new myFunction("John","Doe");
x.firstName;
// Will return "John"
Comments
Post a Comment