Jaws - coming soon - testers and advice wanted

Filippo Pacini (S.G. Consulting) pacini@REDACTED
Mon Feb 20 13:13:44 CET 2006


Hi,
I might be able to do some testing, and maybe help a little with
javascript, though I'm an Erlang newbie.

Regarding the javascript below something like this should work:

elRef is a reference to the a element, so instead of bar() you call the
function as
bar(this);

function bar(elRef) {
    while (elRef) {
       var elRef = elRef.parentNode;
       if (elRef.nodeName.toLowerCase() == 'div') {
          alert(elRef.getAttribute('id'));
          return
       }
    }
}

Tested on firefox: it works if you write the link as
<a href="javascript:;" onclick="return bar(this);">click</a>

Not if you call bar directly in the href. I have no idea why.

Filippo Pacini


Joe Armstrong (AL/EAB) wrote:
>  
> 
> In particular does anybody have any ideas how to do this?
> 
> If I have this
> 
>          <div id="foo">
>           ....
>           ...  <a href="javascript:bar()">click</a>
> 
>          </div>
> 
>  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?
> 
> /Joe
> 





More information about the erlang-questions mailing list