As seen in http://code.google.com/apis/desktop/docs/gadget_apiref.html#elements
there is an attribute "count" and a method "item()". You can use
element.children.count to get the number of children. You can also use
element.children.item(idx) or element.children.item("name") to get a
child directly.

Some major difference between this item() and the getElementsById()
function are:
- item() only returns one element, not all elements that match
- getElementsById() works recursively while item() only finds direct
children.
- item() can be called with the index of the element or the name of
it. There is no id="xx" attribute in Google Desktop, only name="xx".

In your case you would call the following code to change the value of
your "'b'+x + '_' + y" element which is assumed to be a direct
descendant of the element named "foo".

var ele = foo.children.item('b' + x + '_' + y);
ele.value = "bar";

Hope this helps,
Benjamin

On Feb 10, 5:43 am, blhc <[email protected]> wrote:
> Ok...so i how does this children attribute work? a possible workin
> syntax example perhaps? thnks for poinitin the document part so far!
>
> On Feb 7, 10:25 am, "Benjamin [API Guru]" <[email protected]>
> wrote:
>
> > The method document.getElementsById() is specific to DOM interaction
> > in the browser. Google Desktop does not support these DOM calls. Have
> > a look 
> > athttp://code.google.com/apis/desktop/docs/gadget_apiref.html#basicElement
> > especially the children attributes on how to iterate through the
> > elements of a specific element.
>
> > Best regards,
> > Benjamin
>
> > On Feb 4, 8:48 am, blhc <[email protected]> wrote:
>
> > > this works in js but in google desktop gadget it says document
> > > undefined
> > > document.getElementById('b'+x + '_' + y).value = ' ';
> > > how to i change this so that it can be used in google api
> > > thanks
> > > lee
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Desktop Developer Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Desktop-Developer?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to