In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...

Perhaps you need to get elements from the collection.
Otherwise, I don't understand whay do you need loop for?

> I am trying to figure out a way to disable links in my embedded app, and
> I have been unsuccessful. After some investigation, I would have thought
> the following code snippet to be a solution to my problem:
> 
>     nsCOMPtr<nsIDOMHTMLDocument> domdoc;
>     rv = doc->QueryInterface(nsIDOMHTMLDocument::GetIID(),
>                              getter_AddRefs(domdoc));
> 
>     if (NS_FAILED(rv)) return;
> 
>     nsCOMPtr<nsIDOMHTMLCollection> links;
>     domdoc->GetLinks(getter_AddRefs(links));
> 
>     PRUint32 numnodes;
>     links->GetLength(&numnodes);
> 
>     nsCOMPtr<nsIDOMNode> link;
>     for (unsigned int i = 0; i < numnodes; i++)
>     {
>         // The following line does not produce the correct result. The
> elements in the
>         // collection are of the type nsIDOMHTMLAnchorElement...
>         nsCOMPtr<nsIDOMHTMLLinkElement>     alink =
> (do_QueryInterface(link));
> 
>         alink->SetDisabled(FALSE);
>     }
> 
> If anyone knows of a solution to this problem, I would appreciate
> hearing from you. Thanks.
> 
> John Stewart
> 
> 

-- 
--
Regards,
Waleri

Reply via email to