Hello. A question.
It is possible to refer to the ID of an element within the element
itself? And, if yes, what is the instruction or function.
Example. Assume I have this:
<div id="Square1" onclick = "Clicked('Squar e1')"></div>
You see the ID of the element "Square1" also appears later on the
function invocation "Clicked('Squar e1')". My question is: can I replace
the second occurrence of "Square1" with an instruction indicating the
current ID element? How?
For instance, I assume the instruction existed and were
"CurrentElmID() ", I would have:
<div id="Square1" onclick = "Clicked(Curren tElmID())"></div>
Hope my question is clear. Thanks.
-Pam 4 10924
wrote on 23 aug 2006 in comp.lang.javas cript:
Hello. A question.
It is possible to refer to the ID of an element within the element
itself? And, if yes, what is the instruction or function.
Example. Assume I have this:
<div id="Square1" onclick = "Clicked('Squar e1')"></div>
[..]
<div id = 'Square1' onclick = 'alert(this.id) '>
Content
</div>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Evertjan. wrote:
wrote on 23 aug 2006 in comp.lang.javas cript:
Hello. A question.
It is possible to refer to the ID of an element within the element
itself? And, if yes, what is the instruction or function.
Example. Assume I have this:
<div id="Square1" onclick = "Clicked('Squar e1')"></div>
[..]
<div id = 'Square1' onclick = 'alert(this.id) '>
Content
</div>
Although virtually the only useful thing that can be done with that ID
is to use it to look up a reference to the element in the DOM, and as -
this - is a reference to that element at the point when its - id -
property is read it would be more sensible to pass the reference on the
function called instead of a string ID.
Richard.
Thanks Evertjan, very helpful.
Thanks Richard for the comments.
I need it because I prefer to have updatable code in one place only:
more maintenable.
I hope there are no browser compatibility issues with this one :).
Thank you very much.
-Pam
Richard Cornford ha scritto:
Evertjan. wrote:
wrote on 23 aug 2006 in comp.lang.javas cript:
Hello. A question.
It is possible to refer to the ID of an element within the element
itself? And, if yes, what is the instruction or function.
Example. Assume I have this:
>
<div id="Square1" onclick = "Clicked('Squar e1')"></div>
[..]
<div id = 'Square1' onclick = 'alert(this.id) '>
Content
</div>
Although virtually the only useful thing that can be done with that ID
is to use it to look up a reference to the element in the DOM, and as -
this - is a reference to that element at the point when its - id -
property is read it would be more sensible to pass the reference on the
function called instead of a string ID.
Richard.
Richard Cornford wrote on 23 aug 2006 in comp.lang.javas cript:
Evertjan. wrote:
>wrote on 23 aug 2006 in comp.lang.javas cript:
Hello. A question.
It is possible to refer to the ID of an element within the element
itself? And, if yes, what is the instruction or function.
Example. Assume I have this:
<div id="Square1" onclick = "Clicked('Squar e1')"></div>
[..]
<div id = 'Square1' onclick = 'alert(this.id) '> Content </div>
Although virtually the only useful thing that can be done with that ID
is to use it to look up a reference to the element in the DOM, and as -
this - is a reference to that element at the point when its - id -
property is read it would be more sensible to pass the reference on the
function called instead of a string ID.
"Going back to square1" should be an option.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Don G |
last post by:
Within the menu for my site, I have inserted 'class="current"' within
the link for the current page. So the link looks somthing link:
<li><a href="index.php" class="current">Home</a></li>
The css for formatting the menu links is:
#menu a:hover {
background-color: #E00080;
color: white;
|
by: Matej Cepl |
last post by:
I know about element.style.fontSize, but it seems to work here (with Mozilla
Firefox 1.0.6) just only when the fontSize was set via CSS. Can I get
somewhere current size of the font in the actual element. Explanation:
PeopleSoft uses very small font (9pt), which on Mozilla looks pretty small.
Unfortunately, it is set somewhere in their Javascript, so apparently it
fools even "Minimal font size" in Mozilla's settings. Therefore, I would...
|
by: Davids |
last post by:
darn stuck again!
in my string array
string myArray = string;
Let's say I've put a string field into the first 3 items and I guess the
other 23 must then be null, right? OK so is there any C# method/property to
find the next empty (null) item? The Length property always returns the
total items ie 26!
|
by: VB Programmer |
last post by:
When my users login I want them to be able to change some of their personal
info in a db. I want to use a detailsview control for this.
How can I get the detailsview to only pull up the record based on their
USERID ("current user")?
This SqlDataSource doesn't seem to return anything...
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:MyMainDatabase %>"
|
by: RR |
last post by:
I have a button on a form (form A) that opens another form. The form that
opens (form B) has a listbox that is populated with a call to a function in
the "on current" event.
When form B with the listbox has a query listed as the data source, it works
fine.
In this case, the button on form A sets the record source for form B to one
of several queries, depending on what is selected in a combobox on form A.
When Form B first opens, an...
| |
by: MLH |
last post by:
Suppose that code running on FormB
is moving the focus around on FormA
to various textbox controls on FormA -
Which form is the current form during this process?
Is it FormA, which has the focus. Or is it FormB,
whose code is doing the work?
|
by: Jeremy |
last post by:
If we have a table with say 3 rows in it and one of the columns contains
a checkbox such as
<table>
<tr>
<td><input type="checkbox" name="ch_fld"></td>
</tr>
<tr>
<td><input type="checkbox" name="ch_fld"></td>
</tr>
|
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...
|
by: Alex |
last post by:
For example, i have some part of XML file.
<AppSettings>
<Object ClassVersion="1.0.0.0" Type="AppSettings">
<Fields>
<Field Name="App_ID" Type="System.Int32">
<Value>
<int>-1</int>
</Value>
</Field>
|
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...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |