By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,385 Members | 1,767 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,385 IT Pros & Developers. It's quick & easy.

How to get attributes of a column in Netscape 4.08?

P: 2
I need to get the attributes of a column in netscape navigator 4.08.

In IE I have got the result for the following script.

[HTML]<html>
<head>
<script language="JavaScript">

function getAttr()
{

alert(event.srcElement.className);
// the output will be :- col;

alert(event.srcElement.name);
// the output will be :- lblCol1;

}
document.onmousedown=getAttr;
</script>
</head>
<body>
<form name="frm1" method="post" action="">

<table>
<tr>
<td class="col" name="lblCol1" id="lblCol1">Hello</td>
</tr>

</table>

</form>
</body>
</html>
[/HTML]
What change I need to do to get the class name and name.

could anybody help me please.

Thanks in advance.
Sep 20 '06 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
You need to pass the event as an argument for non-IE browsers, i.e.
Expand|Select|Wrap|Line Numbers
  1. function getAttr(e) {
  2.     if (!e) e = window.event;
  3.     // now 'e' is the event in all browsers
Next, the element which is the target, is srcElement in IE, but target in other browsers, so:
Expand|Select|Wrap|Line Numbers
  1. if (e.target) target = e.target;
  2. else if (e.srcElement) target = e.srcElement;
  3. // now target contains the target element
May 14 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.