[Javascript] getting the id of the parent tag

Peter Brunone peter at brunone.com
Mon Jul 14 09:32:21 CDT 2003


Sachin,

	In IE, I know you can object.parentElement.id property of most
tags; this seems to be a standard, or at least close to it, so I'd be
surprised if it didn't work in Netscape 6 and 7.

Cheers,

Peter

-----Original Message-----
From: javascript-bounces at LaTech.edu
[mailto:javascript-bounces at LaTech.edu] On Behalf Of Sachin Zingade

Hi,

I need to get the id of the parent tag when i select some text from that
tag.

Example:

<p id="209202920290"> This is test para This is test para This is test
para This is test para</p>

So when i select " test para " i should get "209202920290".


Next requirement is

<p id="209202920290"> This testststst <i> This is test para </i> test
para</p>

So when i select " is test para"  which is inside the italic tag , i
should get "209202920290".

If any one can reply it would be great

Sachin Z



More information about the Javascript mailing list