Created
March 15, 2015 19:43
-
-
Save jamc92/d1a2ad01261919286518 to your computer and use it in GitHub Desktop.
JS - OOP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Oriented Object Programming</title> | |
<script type="text/javascript"> | |
//Creating an objetc | |
objeto = new Object(); | |
//Creating an object's property | |
objeto.info = "Esta es a info de la propiedad"; | |
//Setting a funcion | |
function miFunction() { | |
//Calling the info's content | |
alert(this.info); | |
} | |
//Assigning a function to an object.property | |
objeto.showInfo = miFunction; | |
</script> | |
</head> | |
<body> | |
<!--Calling an object function from a button--> | |
<button onclick="objeto.showInfo()">Info</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment