Jump to content

Search the Community

Showing results for tags 'property'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 6 results

  1. DILEMMA: I have a fairly complex JSON object that is introduced via an AJAX call. Unfortunately, my control panel tells me that it is undefined. Is this because it has no value? Or, is it because I do not know how to read the value properly? {"lastVisits"[{"firstVisit":{"prettyDate":"Monday, May 14, 2018"}}]} The name of the variable into which it is read is visitor_data. Am I reading the value of correctly? visitor_data.lastVisits[0].firstVisit.prettyDate Roddy
  2. Cu.import("resource://gre/modules/NewTabUtils.jsm"); var { links: gLinks, allPages: gAllPages, linkChecker: gLinkChecker, pinnedLinks: gPinnedLinks, blockedLinks: gBlockedLinks, gridPrefs: gGridPrefs } = NewTabUtils; and the scipt of NewTabUtils.jsm is /** * Singleton that provides the public API of this JSM. */ this.NewTabUtils = { a_Property_is_here: false, Some_Method_A: function Some_Method_A() { } Some_Method_B: function Some_Method_A() { } And_so_on: function And_so_on() { } links: Links, allPages: AllPages, linkChecker: LinkChecker, pinnedLinks: PinnedLinks, blockedLinks: BlockedLinks, gridPrefs: GridPrefs, placesProvider: PlacesProvider, activityStreamLinks: ActivityStreamLinks, activityStreamProvider: ActivityStreamProvider }; What does the part "var{properties}=NewTabUtils;" mean? I understand if that's "NewTabUtils={properties};" And another minor question is about the second script, in the Class-like JS methods, properties are asigned at bottom of the script, also bottom of the file. I guess that's because it is easy to read, but not sure the reason. Would somebody know these questions? thanks.
  3. Hi, Is it possible to access property of the object using variable, for example I have the object named "objExample" with properties named: Property1 Property2 Property3 Property4 ... Property10 I would like to access all of these properties in FOR loop using variable propertyName = " Property " & i in each step, but I don't know how to make it. The code below it's an simple example of my problem ("???" indicates piece of code which I missing): Dim i Dim propertyName Dim objExample Set objExample = ....... For i = 1 To 10 propertyName = " Property " & i objExample.??? = ...... ...... Next Best regards
  4. Good afternoon Can someone explain to me the difference between these properties, please? As for me are one and the same. Regards: Marek
  5. <!DOCTYPE html><html><head><script>function myFunction(e){ alert(e.target);}</script></head><body onclick="myFunction(event)"><p>Click on a paragraph. An alert box will alert the element that triggered the event.</p><p><strong>Note:</strong> The target property returns the element that triggered the event, and not necessarily the eventlistener's element.</p></body></html> Hi guys, I am really struggling with this right now, please help. As you can see the above, I don't really understand these lines of code <body onclick="myFunction(event)">, and function myFunction(e) {alert(e.target);} what do "event" and "e" do, I know they are parameters which I can use whatever I like, my question is, why do I need "event" and "e" parameters here, and why are they so important? Second question, this line <body onclick="myFunction(event)">, I don't really know what the difference between <body onclick="myFunction(event)"> and <body onclick = myFunction>(without parenthesis and quotes). Thanks a bunch guys.
  6. I’m working my way through Javascript Step by Step (Steve Suehring, Microsoft Press) and I’m having difficulty understanding the way the words ‘object’ and ‘property’ are used in the book. In this post I will put verbatim extracts from the book in blue. Things start off simply enough: You can create an object in Javascript in two ways: * Using the new keyword, as shown here: var star = now Object; * Using curly braces, as shown here: var star = {}; The author explains there is no concept of classes in Javascript, but shows how to create objects using pseudo-class constructors: var star = {}; function Star(constell,type,specclass,magnitude) { this.constellation = constell; this.type = type; this.spectralClass = specclass; this.mag = magnitude;} star["Polaris"] = new Star("Ursa Minor","Double/Cepheid","F7",2.0);star["Mizar"] = new Star("Ursa Major","Spectroscopic Binary","A1 V",2.3);star["Aldebaran"] = new Star("Taurus","Irregular Variable","K5 III",0.85);star["Rigel"] = new Star("Orion","Supergiant with Companion","B8 Ia",0.12);star["Castor"] = new Star("Gemini","Multiple/Spectroscopic","A1 V",1.58);star["Albireo"] = new Star("Cygnus","Double","K3 II",3.1);star["Acrux"] = new Star("Crux","Double","B1 IV",0.8);star["Gemma"] = new Star("Corona Borealis","Eclipsing Binary","A0 V",2.23);star["Procyon"] = new Star("Canis Minor","Double","F5 IV",0.38);star["Sirius"] = new Star("Canis Major","Double","A1 V",-1.46);star["Rigil Kentaurus"] = new Star("Centaurus","Double","G2 V",-0.01);star["Deneb"] = new Star("Cygnus","Supergiant","A2 Ia",1.25);star["Vega"] = new Star("Lyra","White Dwarf","A0 V",0.03);star["Altair"] = new Star("Aquila","White Dwarf","A7 V",0.77); The heading he puts on this section is Assembling a star object using a pseudo-class. Note he uses the singular. He doesn’t say ‘Assembling star objects’. The next section is headed Displaying Object Properties and has the following code and explanation: With a for…in loop, you can loop through each of the properties in an object: DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>Properties</title> <script type="text/javascript"> var star = {}; function Star(constell,type,specclass,magnitude) { this.constellation = constell; this.type = type; this.spectralClass = specclass; this.mag = magnitude; } star["Polaris"] = new Star("Ursa Minor","Double/Cepheid","F7",2.0); star["Mizar"] = new Star("Ursa Major","Spectroscopic Binary","A1 V",2.3); star["Aldebaran"] = new Star("Taurus","Irregular Variable","K5 III",0.85); star["Rigel"] = new Star("Orion","Supergiant with Companion","B8 Ia",0.12); star["Castor"] = new Star("Gemini","Multiple/Spectroscopic","A1 V",1.58); star["Albireo"] = new Star("Cygnus","Double","K3 II",3.1); star["Acrux"] = new Star("Crux","Double","B1 IV",0.8); star["Gemma"] = new Star("Corona Borealis","Eclipsing Binary","A0 V",2.23); star["Procyon"] = new Star("Canis Minor","Double","F5 IV",0.38); star["Sirius"] = new Star("Canis Major","Double","A1 V",-1.46); star["Rigil Kentaurus"] = new Star("Centaurus","Double","G2 V",-0.01); star["Deneb"] = new Star("Cygnus","Supergiant","A2 Ia",1.25); star["Vega"] = new Star("Lyra","White Dwarf","A0 V",0.03); star["Altair"] = new Star("Aquila","White Dwarf","A7 V",0.77); </script></head><body><script type="text/javascript" > for (var propt in star) { alert(propt); } </script></body></html> View this page in a web browser. You are presented with an alert() dialogue box for each of the stars in the star object, for a total of 14. Here’s an example of the type of dialog box you see: (displays alert box with 'Polaris', followed by 13 more alerts, Mizar through to Altair) This step-by-step builds on the earlier example of using pseudo-classes to define properties of objects. In this case, a star object was created with the following code: var star = {}; That object was then given several properties of individual star names by using a call to create a new Star [sic] object (using the pseudo-class): star["Polaris"] = new Star("Ursa Minor","Double/Cepheid","F7",2.0); Each property of the original star object, in this case the name of each star, was then enumerated within the <body> of the code using a for…in loop: for (var propt in star) { alert(propt); } You might be wondering how to get the actual properties of the stars, such as the constellations, magnitudes, types and spectral class. Chapter 14 shows you how to enumerate through each of these. The bits in bold are what trouble me. Here are my questions: 1. When the block of code above is run, how many objects are created in total? 1, 14 or 15? 2. Would it be right or wrong to call the result a collection of objects (in the sense of a Visual Basic collection)? 3. Is the word preceding my [sic] mark a typo for star, seeing that Star is the name of a function, not an object? 4. When the author refers to the named properties of star (constell, type, specclass, magnitude) as it’s ‘actual properties’ (his last para), is he implying that the star name (e.g. Polaris) is not a true property? Hope someone can clear this up so I can get on to the next chapter!
×
×
  • Create New...