473,396 Members | 1,789 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.

Refer to current DIV tag

I need to tell which DIV tag the event occurred on. For example, I
have 3 DIV tags. Inside each DIV tag I have an INPUT text with the
same name. Say if I change the value of the INPUT text in the second
DIV tag (line_2), how can I identify that the change occurred in that
DIV. I was hoping to use something like 'this.div' but that doesn't
seem to work. I don't want to hardcode each DIV id on the onchange
event. Thanks...

function oC(div){
alert(div.id);
}

<DIV id="line_1">
<INPUT type="text" name="fld" onchange="oC(this.div)">
</DIV>
<DIV id="line_2">
<INPUT type="text" name="fld" onchange="oC(this.div)">
</DIV>
<DIV id="line_3">
<INPUT type="text" name="fld" onchange="oC(this.div)">
</DIV>
Dec 19 '07 #1
2 2016
mo*****@yahoo.com wrote:
function oC(div){
alert(div.id);
}

<DIV id="line_1">
<INPUT type="text" name="fld" onchange="oC(this.div)">
Use
oC(this.parentNode)

--

Martin Honnen
http://JavaScript.FAQTs.com/
Dec 19 '07 #2
On Dec 19, 9:13 am, Martin Honnen <mahotr...@yahoo.dewrote:
moua...@yahoo.com wrote:
function oC(div){
alert(div.id);
}
<DIV id="line_1">
<INPUT type="text" name="fld" onchange="oC(this.div)">

Use
oC(this.parentNode)

--

Martin Honnen
http://JavaScript.FAQTs.com/
Thanks, Martin!!!
Dec 19 '07 #3

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

Similar topics

1
by: MK | last post by:
What would be the best platform-independent way to refer to the current (execute) path for a Python script? self.dirname = ??? This variable should contain directory name for the current path....
1
by: 5tein | last post by:
I mean, with XSL functions such as SELECT can I only refer to XML element values or can I somehow also refer to XML attribute values? Is there any way to refer to XML content based on attribute...
7
by: Ivo | last post by:
How do I make the magic 'this' variable refer to an object of my choice, in a string of code which is to be eval'ed? Say, I have an object, an array with four elements: var myobject = ; and a...
3
by: Joshua Ammann | last post by:
Hi, (Using Access 2000) I have two tables, similar to Customers and Orders. (Not an exact parallel, but works for this example.) On a form showing customer data, there is a tab control. One...
16
by: ben beroukhim | last post by:
I have huge number of legacy code which use standard files functions. I would like to pass a memory pointer rather than a FILE pointer. I am trying to use FILEs in the code to refer to memory...
2
by: ProRodman | last post by:
Dear all, I know that "me" can be used to refer current active form. How can I refer an object (e.g. a button) within it's own event code without using the object name (something just like...
7
by: Ryan | last post by:
I'm wanting to find the value of TableID on the current record displayed on my form. I cannot seem to find any method within the TableAdapter class to find this. An example I've found MS uses a...
1
by: Kai Zhu | last post by:
I've write a script like this. <script> function A() { this.onMouseDown = function(event) { ..... } } var objA = new A(); htmlelement.onmousedown = a.onmousedown; </script>
6
by: Savante | last post by:
I have been writing a datalogging application. It reads in double's into a database. I want to be able to click on a row in a database (holds name of variable and also current value of variable)...
4
by: Lysander | last post by:
I need a way of finding the name of the active control on a form. You can use currentdb() to refer to the current database You can use Me to refer to the active form or report. I need a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...

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.