473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

user-defined element properties: cross-browser?

I've noticed that this is possible in IE:

<span class='sweetfeature' myproperty='Napoleon Dynamite'
onclick="ShowProperty(this);" >
Click here for the name of a hilarious movie.
</span>

and then in a script:

function ShowProperty(e) {
alert(e.myproperty);
// or
// alert(e['myproperty']);
}

Is there a counterpart functionality in Firefox, NS, and Opera, or is this a
proprietary MSFT feature that the other browser vendors do not support?
Thanks
TR
Jul 23 '05 #1
4 2574
Timo wrote:
Is there a counterpart functionality in Firefox, NS, and Opera


Depends on the doctype you use. What you showed is not valid HTML.

ciao, dhgm
Jul 23 '05 #2


Timo wrote:
I've noticed that this is possible in IE:

<span class='sweetfeature' myproperty='Napoleon Dynamite'
onclick="ShowProperty(this);" >
Click here for the name of a hilarious movie.
</span>

and then in a script:

function ShowProperty(e) {
alert(e.myproperty);
// or
// alert(e['myproperty']);
}

Is there a counterpart functionality in Firefox, NS, and Opera, or is this a
proprietary MSFT feature that the other browser vendors do not support?


The core DOM offers the getAttribute method for element objects so
if (e.getAttribute) {
alert(e.getAttribute('myproperty'));
}
is probably what you are looking for.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #3
Thanks for the reply, Dietmar. Do I understand you correctly, that it would
be possible to achieve this user-defined property functionality
cross-browser, simply by declaring the appropriate doctype?
TR

"Dietmar Meier" <us***************@innoline-systemtechnik.de> wrote in
message news:36*************@individual.net...
Timo wrote:
Is there a counterpart functionality in Firefox, NS, and Opera


Depends on the doctype you use. What you showed is not valid HTML.

ciao, dhgm

Jul 23 '05 #4
Thank you, Martin.

"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:42*********************@newsread2.arcor-online.net...

that the other browser vendors do not support?

The core DOM offers the getAttribute method for element objects so
if (e.getAttribute) {
alert(e.getAttribute('myproperty'));
}
is probably what you are looking for.
Martin Honnen

http://JavaScript.FAQTs.com/

Jul 23 '05 #5

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

Similar topics

2
by: Sandman | last post by:
Just looking for suggestion on how to do this in my Web application. The goal is to keep track of what a user has and hasn't read and present him or her with new material I am currently doing...
3
by: zlst | last post by:
Many technological innovations rely upon User Interface Design to elevate their technical complexity to a usable product. Technology alone may not win user acceptance and subsequent marketability....
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
3
by: Jiho Han | last post by:
Should ASPNET user belong to the local Users group? I may have made some changes that affected my workstation setup and I am experiencing some unexpected behaviors. For example, I have my IIS...
1
by: Robert Howells | last post by:
Perhaps I'm just too new at this to pull it off, or perhaps it's just bad architecture. I'd appreciate some feedback on the the wisdom (or lack thereof) in attempting the following: I'm not new...
4
by: Guadala Harry | last post by:
Is there any way for one Session to remove and update objects in another Session? I seriously doubt it, but thought I'd ask. Here's why: I have some data that is unique per user (or per session -...
17
by: Alphonse Giambrone | last post by:
I am building a web app for users to add/edit data. They may add/edit several records during a session. When they are done (not necessarily immediately, could be 10 or more minutes later), I need...
9
by: Gordon | last post by:
I want to add a feature to a project I'm working on where i have multiple users set up on my Postgres database with varying levels of access. At the bare minimum there will be a login user who...
14
by: chromis | last post by:
Hi, I've been trying to implement a more OOP oriented approach to dealing with user security on one of my websites, and I am trying to validate the user against an array of roles, however I am...
3
by: shapper | last post by:
Hello, On my web site I have a property, Visitor, which is available for Anonymous users: public class Visitor { public CultureInfo Culture { get; set; } public List<GuidPolls { get; set;...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
0
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...

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.