Search the Community
Showing results for tags 'object'.
-
Hi, I started reading the chapter about Document Object Model, and I have a few beginner questions: 1. Quote from book: Isn't HTML element the root node? 2. Quote from book: But on http://www.w3schools.com/jsref/prop_node_nodetype.asp and https://developer.mozilla.org/en-US/docs/Web/API/Node.nodeType this is different: Also, what is the difference between "1 for an HTML element" and "10 for the HTML element"? I guess that's a mistake. Thank you in advance!
-
Hi, I have one question about this. In the book it is written that "Doing the above would call the init() function and assign the value returned by it to the window.onload property, which is not the intent." Let's say that somewhere in JavaScript exsist the following code: var init = function() { //some code return something; } Here, a function definition is a value assigned to a variable. Now, we have: window.onload = init; and that code assigns to the onload property of the window object the value of the init variable. OK. Let's suppose that there exists the following function which does the same function init() { //some code return something; } In this case, it would be the same to use: window.onload = init; AND window.onload = init(); But in reality, this is not the case, there is no init() function, there is only init variable so it isn't the same. Am I right?
-
hi using a static counter variable in a class lets us to count the number of objects created so far is there a way to to access all Live objects instantiated from a class.(not just the number of them but the names of them !) i want to write a simple code for a human class . and in its __construct method i want that object to say hello to all previously created objects!
-
var U = { $: function(id) { 'use strict'; if(typeof id = 'string') { return document.getElementById(id); } // end of typeof } // end of $() function } // end U object This is a rather simple question. The text says the $() function is a property of U, isn't this function technically a method and not a property? Thanks, Mark