object and event
object source code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
var car = {color:'red',wieght:'500kg',sum : function(){
return 'the car color is '+ this.color + ' and wieght is ' + this.wieght;
}};
// car.color = 'blue'; // change object properties
console.log(car.color);
document.write(car['color']);
document.write(car.color);
document.write(car.sum());
</script>
</body>
</html>
event source code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body >
<button onclick="func()">click me</button>
<p id="demo" onmouseover="second()" onmouseout="thirdp()">This is text</p>
<script>
function func(){
alert('alert box');
}
function second(){
document.getElementById('demo').style.color= 'red';
}
function thirdp(){
document.getElementById('demo').style.color= 'black';
}
</script>
</body>
</html>
object and event
intor of object 00.01
creating properties 01.40
access object properties 02.30
methods in obejct and access of methods 03.25
this keyword in object 06.05
object :- object is an real world entity which we are going to use in programming by accessing its properties and method . We can say object is a container of variables.
object are created with { }
In this video we are going to learn about object , object methods , object properties and how to access object .
IF you want to change object values than you can do it easily by using simple steps shown in the video.
object properties - it like an real world object properties like color , weight etc.
object method - It is functions in object which can we call dynamically and manually both easily.
event - events are the browser actions that perform perticular task in browser . We are going to discuss here onclick , onmouseout , onmouseover events also I will tell you the website W3school where you can simply find all events in sequecial manner and also execute that event in real time.
all events list are here below
www.w3school.com
No comments:
Post a Comment