climbing to the next-higher scope from "this"

D

drblitzkrieg

Hi,

say you have an input from a form, and you want to be able to refer to
a containing tag, without knowing its particular name. For example, in
the following:

<div id="div1">
<select name="myinput" onChange="changeDiv( ??? ,
this.selected.text);">
<option>....</option>
<option>...</option>
</select>
</div>

<div id="div2">
.....(similar content)
</div>

What I want to do where the "???"s are is pass it a reference to the
"div1" tag. If we use the "this" keyword in that onChange, it refers
to the "myinput" droplist, so is there a property of any object to
access its next-highest encompassing tag/object/frame/div/form in
particular?

Thx,
 
R

RobG

Hi,

say you have an input from a form, and you want to be able to refer to
a containing tag, without knowing its particular name. For example, in
the following:

<div id="div1">
<select name="myinput" onChange="changeDiv( ??? ,
this.selected.text);">
<option>....</option>
<option>...</option>
</select>
</div>

<div id="div2">
....(similar content)
</div>

What I want to do where the "???"s are is pass it a reference to the
"div1" tag. If we use the "this" keyword in that onChange, it refers
to the "myinput" droplist, so is there a property of any object to
access its next-highest encompassing tag/object/frame/div/form in
particular?

If you are talking about DOM objects, then you are looking for the
parentNode property.

<URL: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1060184317 >
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,147
Messages
2,570,833
Members
47,380
Latest member
AlinaBlevi

Latest Threads

Top