开发者

Dynamically create an element in google desktop

How can I dynamically create elements, like labels and such, using the google desktop API? Put differently, how can开发者_如何学C I duplicate the browser's:

document.createElement('br');


Sorry for the delayed answer. Look at:

http://code.google.com/apis/desktop/docs/gadget_apiref.html#view

for

appendElement(string xml) Parses the provided element definition, given in XML format, and appends the element as the last child of this view. Returns The new element

Usage example is as follows:

var divXml = "<div enabled='true' height='40' name='divMsg1' width='243' x='0' y='40' background='#FFFFFF'><label height='20' name='lblName1' width='190' x='0' y='0'>Name</label><label height='20' name='lblStatus1' width='50' x='190' y='0' align='right' color='#FF0000'>Status</label><label height='20' name='lblDate1' width='150' x='0' y='21' size='8'>Date</label></div>";
view.appendElement(divXml);

I am using this piece of code in my own Gadget but made a few changes to make it generic enough to post here. It should hopefully work as is.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜