Jaws - coming soon - testers and advice wanted

Chris Double <>
Mon Feb 20 13:29:11 CET 2006

On 2/20/06, Joe Armstrong (AL/EAB) <> wrote:
>  I want bar() to compute the id if the nearest containing div - in this
> case "foo" any ideas how to do this? - do I really have to "walk the
> tree" from the root of the DOM tree?

Some javascript code to do this:

function enclosingDiv(node) {
  while(node && node.nodeName != "DIV") {
    node = node.parentNode;
  return node;

function bar(self) {
  var node = enclosingDiv(self);
    alert("No Div node");
  return false;

<div id="foo">
    <div id="baz">
	<a onclick="bar(this);" href="#"><div>click</div></a>

This should alert with 'baz', the nearest enclosing div.


More information about the erlang-questions mailing list