Dynamic Tabstrip not working

G

Guest

I'm using the IE webcontrols (obviously) trying to dynamically generate a
tabstrip based of a DTS package. I can get the tabstrip to show if I assign
the generation after the page completely loads and I trigger the execution to
a button/click/etc... However if I try to link the execution to onLoad I get
"dynaPage is undefined." DynaPage being the multipage I create dynamically.
Not sure why, and what I need to change to fix this. Any ideas?? Thanks in
advance!

<HTML>
<HEAD>
<TITLE>TabStrip Test</TITLE>
<script>
var lastPage = false;
function setupReport(oButton)
{
addPage("Test1","1");
addPage("Test2","2");
addPage("Test3","3");
lastPage = true;
addPage("Test4","4");
showPage(dynaPage);
hideButton(oButton);
}
function addPage(name, content)
{
var pageIndex = dynaPage.numPages;
var oNewPage = dynaPage.createPageAt(pageIndex);

oNewPage.setAttribute("id", name);
oNewPage.setAttribute("innerHTML", content);
addTab(name);
}

function addTab(pageID)
{
var tabElements = dynaTab.numItems;
var oNewTab = dynaTab.createTabAt(dynaTab.numItems);
oNewTab.setAttribute("text", pageID);
addTabSeparator();
}

function addTabSeparator()
{
var tabElements = dynaTab.numItems;
var oNewSep = dynaTab.createSeparatorAt(tabElements);
if (lastPage){oNewSep.setAttribute("defaultStyle","width:100%;");}
}

function importBehaviors() {
tsNS = document.namespaces.add("ts","tabstrip.htc");
mpNS = document.namespaces.add("mp","multipage.htc");
tsNS.doImport("tabstrip.htc");
mpNS.doImport("multipage.htc");
var oTabStrip = document.createElement("ts:TABSTRIP");
var oMP = document.createElement("mp:MULTIPAGE");
oTabStrip.id = "dynaTab";
setTabStyle(oTabStrip);
oMP.id = "dynaPage";
setPageStyle(oMP);
oTabStrip.targetID = "dynaPage";
oReport.appendChild(oTabStrip);
oReport.appendChild(oMP);
}
function setTabStyle(tab)
{
var dStyle = "color:#AAAAAA; background-color:#EEEEEE;
border-color:#AAAAAA; ";
dStyle += "border-width:1px; border-style:solid; font-weight:bold; ";
dStyle += "font-family:Verdana; font-size:11px; height:37px; width:100px;
";
dStyle += "text-align:center;";
tab.setAttribute("tabDefaultStyle", dStyle);
tab.setAttribute("tabHoverStyle", "color:blue");
var sStyle = "color:#000000; background-color:#FFFFFF; border-bottom:none";
tab.setAttribute("tabSelectedStyle", sStyle);

var defStyle = "background-color:#FFFFFF; border-color:#AAAAAA; ";
defStyle += "border-width:1px; border-style:solid; border-top:none; ";
defStyle += "border-left:none; border-right:none;";
tab.setAttribute("sepDefaultStyle",defStyle);
}
function setPageStyle(page)
{
page.style.borderStyle="solid";
page.style.borderColor="#AAAAAA";
page.style.borderWidth="1px";
page.style.borderTop="none";
page.style.padding="10px";
page.style.visibility="hidden";
page.style.height="210px";
page.style.width="100%";
}

function hideButton(button)
{
button.style.visibility = "hidden";
}

function showPage(page)
{
page.style.visibility = "visible";
}
</script>
</HEAD>
<BODY onload="setupReport(document.all.generateButton);">
<P ID="oReport">
<BUTTON ID="generateButton" onclick="setupReport(this);">Generate
Report</BUTTON>
</P>
</BODY>
</HTML>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top