I am just starting to read about gadgets and I was playing around with
the examples on the gadget editor page. However, I can't seem to be
able to get the _IG_FetchXmlContent method to work in the callback
below. Any ideas?
Thanks in advance
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Simple Tabs" height="140" scrolling="true" >
<Require feature="tabs" />
</ModulePrefs>
<Content type="html">
<![CDATA[
<script type="text/javascript">
// Initialize tabs, designate the tab named "Two" as
// the tab selected by default.
var tabs = new _IG_Tabs(__MODULE_ID__, "Two");
function init() {
// Technique #1: Capture the tab's ID when you create it, and use the
ID
// to add content to the tab's corresponding <div>.
var one_Id = tabs.addTab("One");
_gel(one_Id).innerHTML = "Content for tab One.";
// Technique #2: Create the tab and define a corresponding <div> in
the
// HTML portion of the gadget. Add static content to the <div>.
tabs.addTab("Two", "two_id");
// Technique #3: Create the tab and define a corresponding <div> in
the
// HTML portion of the gadget. Add static content to the <div>.
// Use a callback function to add dynamic content to the static
content.
tabs.addTab("Three", "three_id", callback);
// Technique #4: Create the tab with a tooltip message. If specified
<div>
// doesn't exist, tabs library creates one.
// Invoke callback function.
tabs.addTab("Four", {
contentContainer: _gel("four_id"),
callback: callback,
tooltip: "I'm special"
});
}
// Callback that provides content to tabs Three and Four
function callback(tabId) {
// XML breakfast menu data
var url = "http://doc.examples.googlepages.com/breakfast-data.xml";
var prefs = new _IG_Prefs(__MODULE_ID__);
_IG_FetchXmlContent(url, function (response) {
if (response == null || typeof(response) != "object" ||
response.firstChild == null) {
_gel(tabId).innerHTML = "<i>Invalid data.</i>";
return;
}
}
// Call init function to initialize and display tabs.
_IG_RegisterOnloadHandler(init);
</script>
<div id="two_id" style="display:none">Content for tab Two.</div>
<div id="three_id" style="display:none">This is static content for tab
Three.</div>
]]>
</Content>
</Module>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"iGoogle Developer Forum" 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-Gadgets-API?hl=en
-~----------~----~----~----~------~----~------~--~---