<html>
<head>
<script>
function Say() {
//private
var nameA = "ha";
//public
this.nameB = "he";
//private
function sayBye() {
return "Bye!" + nameA;
}
//Privileged -> cannot be shared by all instances
this.sayHello = function() {
return "Hello!" + nameA;
}
}
//static
Say.nameC = "wa";
//static
Say.sayBye = function() {
return "Bye!" + this.nameC;
}
//public -> can be shared by all instances
Say.prototype.sayHi = function() {
return "Hi!" + this.nameB;
}
var a = new Say();
a.sayWa = function ()
{
return "Wa!" + a.nameB;
}
alert(a.sayHello());
alert(a.sayHi());
alert(Say.sayBye());
alert(a.sayWa());
var b = new Say();
alert(b.sayHi());
alert(b.sayWa()); //throw exception
</script>
</head>
<body>
</body>
</html>
Showing posts with label JavaScript. Show all posts
Showing posts with label JavaScript. Show all posts
Thursday, February 11, 2016
Friday, June 13, 2014
Get all value from Divs using Jquery
I would like to get all values under a div list into an array.
var list = new Array();
$('.className').each(function() {list.push(this.value);});
Subscribe to:
Posts (Atom)