Windows Sidebar gadget - cannont access a div in Flyout DOM

Posted by cyrix86 on Stack Overflow See other posts from Stack Overflow or by cyrix86
Published on 2010-03-11T22:29:40Z Indexed on 2010/03/12 0:57 UTC
Read the original article Hit count: 429

In the main gadget html, there is a div with an onclick that calls this method in the Gadget script file:

ShowFlyout = function() 
{
    System.Gadget.Flyout.show = true;
    var flyoutDoc = System.Gadget.Flyout.document;
    var mainFlyoutDiv = flyoutDoc.getElementById('divFlyout');
    mainFlyoutDiv.innerHTML = "hello";
}

Here is the Flyout html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title>This is a flyout</title>
    <link href="Css\FlyoutStyle.css" type="text/css" rel="Stylesheet" />
</head>
<body>
    <div id="divFlyout" >
    </div>
</body>
</html>

The problem is that mainFlyoutDiv is always null. When peering into the System.Gadget.Flyout.document object through the debugger, the body parameter is null - I don't think that's right. The System.Gadget.Flyout.file value is being set elsewhere when the gadget first loads.

What am I doing wrong?

Also, does the System.Gadget.Flyout.show property have to be true before the System.Gadget.Flyout.document property can be accessed? My ultimate goal is to open a flyout and dynamically populate it's html

© Stack Overflow or respective owner

Related posts about windows-desktop-gadgets

Related posts about JavaScript