[Phpwm] need a bit of javascript help

Phil Beynon phil at infolinkelectronics.co.uk
Mon Nov 27 16:10:54 GMT 2006


Hi,
Need a bit of help with some javascript please.

I'm using a collapsing tree navigation system called dtree (inside a tabview
system) and building the data array for it directly from PHP against my
knowledgebase tables, the dtree and tabview stuff all works just fine, I
figured that all out perfectly.

What I would like to do though is to redirect the output away from the way
dtree displays the data into a floating popup box that the user can position
and resize as wanted.
I can see that I need to write to the popup by sending the data to a named
<span> or <div> tag (Text) placed within the popup, what I can't do is to
get it to do it by itself, so that whenever the dtree menu is expanded or
collaped the changes are reflected within the popup.

The document.write(h); line writes the data within its own <div> tag just
fine, and I can force a write to the popup using the <input> button onclick
bit at the end - but what I can't get my head around is why the
"document.getElementById("Text").innerHTML = h;" doesnt just write it into
the popup box as it gets to it.

I've removed a load of the array data for clarity as its big. The full code
is at;
http://www.bortec-labs.com/tabview/tabview_after_major_mods.php


<script type="text/javascript">
<!--
h = new dTree('h');
h.add(0,-1,'My Knowledgebase');
h.add(1,0,'Taxation','http://www.bortec-labs.com/manager/pagegroup.php?ident
=20&proc=Edit&');
h.add(2,1,'General','http://www.bortec-labs.com/manager/pagesubgroup.php?ide
nt=135&proc=Edit&searchcrit1=');
h.add(3,2,'Keep Your Receipt  It Might Save You
Money....','http://www.bortec-labs.com/manager/pagecontent.php?id=26&proc=Ed
it&searchcrit1=');
h.add(4,1,'VAT','http://www.bortec-labs.com/manager/pagesubgroup.php?ident=1
57&proc=Edit&searchcrit1=');
h.add(5,4,'Cutting VAT will help Housing
Shortages....','http://www.bortec-labs.com/manager/pagecontent.php?id=35&pro
c=Edit&searchcrit1=');
h.add(6,1,'Health and
Safety','http://www.bortec-labs.com/manager/pagesubgroup.php?ident=139&proc=
Edit&searchcrit1=');
h.add(7,6,'Tax Rules For Occupational
Health....','http://www.bortec-labs.com/manager/pagecontent.php?id=18&proc=E
dit&searchcrit1=');
document.write(h);
document.getElementById("Text").innerHTML = h;
//-->
</script>
<hr>

<script type="text/javascript">
function WriteText()
{
document.getElementById("Text").innerHTML = h;
}
</script>

<input type="button" value="Write to window" onclick="WriteText()"/>


Regards,
Phil




More information about the Phpwm mailing list