473,830 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Property or Attribute?

Howdy all!

When do I call something a property and when do I call something an
attribute?

It has me a little confused at the moment!

Any advice would be most appreciated!

Rob
:)
Jul 20 '05 #1
3 2602
Howdy David!
When do I call something a property


When its CSS.


So I can say that the visibility property can be set to visible or
invisible..
and when do I call something an attribute?


When its HTML or XML.


And I can talk about the SELECTED attribute of a CHECK BOX..
What about in JavaScript? Should I say a SELECT element has OPTION child
elements or properties.. and is the selectedIndex of a SELECT be a property
or attribute when I am accessing them in JavaScript?

I guess I am also gettting confused between JavaScript objects (which I know
are a collection of properties) and objects in the DOM. Do we say that
either of these have attributes?

Thank you very much for your response!

Rob
:)
Jul 20 '05 #2
"Robert Mark Bram" <re********@rem ovethis.optusho me.com.au> writes:
When do I call something a property and when do I call something an
attribute?


The traditional usage is (if I understand it correctly):

- Javascript objects have properties. In "obj.foo" or "obj['foo']",
"foo" is the name of the property. Some properties are functions and
are sometimes called "methods". That is the terminology used in, e.g.,
the ECMS262 specification.

- HTML tags have attributes. In "<body onload='init()' >", "onload='init() '"
is an attribute. We call "onload" the attribute name and "'init()'" is the
attribute value. That is the terminology used in the HTML specifications.

- CSS rules have properties. In "#foo {width:50px;col or:red;}" the
(CSS) properties are "width" and "color". That is the terminology used
in the CSS specifications.
Where it becomes fun is when you write things like:
<div id="foo" style="color:re d;">
and later
document.getEle mentById("foo") .style.color="g reen";

- "document" is a global variable (a property of the global object),
and it refers to the document object.
- "getElementById " is a property of the document object. It is a function
so we call it a method.
- The name "foo" refers to the id attribute of the div tag, and the DOM
*element* (an object) returned by the function call is the DOM
representation of the div *tag*.
- The "style" property of the div element corresponds to the "style"
attribute of the div tag.
- the "color" property of the style element corresponds to the CSS property
"color".

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3
Thank you so much for the reply Lasse,

Your explanation clears up a lot of things for me - in particular the idea
that although each technology maintains its own lingo, they crossover
somewhat.

Thank you again. :)

Rob
:)
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2041
by: DraguVaso | last post by:
Hi, I'm having some weird behaviour, and I can't find any solution to this. I made a UserControl (uclCommands) which contains a Toolbar (ToolBar1) with Modifiers = Public. I put this usercontrol on my form and call it Ucl1. In the Property Window in the Windows Forms Designer I change Ucl1.ToolBar1.ButtonSize to a bigger value.
18
4768
by: Robin Becker | last post by:
Is there a way to override a data property in the instance? Do I need to create another class with the property changed? -- Robin Becker
5
6142
by: David N | last post by:
All, I created a control that have the following property defined: private bool autoSearch My control is compiled and created fine. But, after adding the control to my form, I noticed the following problems:
6
2747
by: Tom Kiefer | last post by:
Question: If I have an ASP.NET User Control which defines/exposes a property that the page can use to specify a mode or data subset for the control to use, is there a way to tell the @OutputCache directive to vary its cache based on that property value? I.e., I have: <my:control runat="server" id="mcOne" Flag="One" /> <my:control runat="server" id="mcTwo" Flag="Two" />
11
3974
by: Andrus | last post by:
I'm implementing entity object which should populate its properties from database when property is first referenced. In RDL reports I use object properties like MyObject.MyProperty MyObject is instance of MyEntity class. There is no MyProperty property in MyObject at design time.
3
2845
by: Bob Cohen \(106531\) | last post by:
I want to define some metadata using custom attributes to apply to properties in various classes. The properties return values that are classes themselves. I want to retrieve the attribute information in the classes from which the fields/properties are derived, but I can't figure out how to get them. I seem to be stuck since the attributes are declared against the property, but the information is returned from the base class; I don't...
8
1647
by: Ethan Kennerly | last post by:
Hello, There are a lot of Python mailing lists. I hope this is an appropriate one for a question on properties. I am relatively inexperienced user of Python. I came to it to prototype concepts for videogames. Having programmed in C, scripted in Unix shells, and scripted in a number of proprietary game scripting languages, I'm impressed at how well Python meets my needs. In almost all respects, it does what I've been wishing a...
0
25611
ADezii
by: ADezii | last post by:
The motivation for this Tip was a question asked by one of our Resident Experts, FishVal. The question was: How to Declare Default Method/Property in a Class Module? My response to the question was inadequate to say the least, but I was determined to come up with the correct answer, especially since my primary background is Visual Basic, and I knew that there was an answer. Well, I did come up with an answer and I decided to incorporate it into...
14
4364
by: Rafe | last post by:
Hi, I've encountered a problem which is making debugging less obvious than it should be. The @property decorator doesn't always raise exceptions. It seems like it is bound to the class but ignored when called. I can see the attribute using dir(self.__class__) on an instance, but when called, python enters __getattr__. If I correct the bug, the attribute calls work as expected and do not call __getattr__. I can't seem to make a simple...
0
9793
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10489
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9314
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7746
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5617
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5780
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4411
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3076
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.