Do I use some of your elder switchcontent.js file ? It's from March 27th, 08 . This are the lines 99 - 102 of it:
Code:
//PRIVATE: Expands a content based on its corresponding header entered
switchcontent.prototype.expandcontent=function(header){
var innercontent=document.getElementById(header.id.replace("-title", ""))
I don't know javascript. The error I described above:
Code:
TypeError: all.expandcontent is not a function ... onclick
appears in some php function. I don't know what is the scope of this
Code:
<script type="text/javascript">
var all=new switchcontent("switchgroup1", "div")
switchcontent instance. Possibly I have to pass this variable all somewhere.
My text is divided in sections $a[n], sub-sections $b[n] and sub-sub-setions $c[n] as php arrays and I print them withe the following php function:
Code:
function myoutput () {
global $head, $intro, $a, $b, $c, $t, $tit, $tail;
echo $head;
echo $intro;
echo '<tr>
<td colspan="3">
<table cellspacing="0" cellpadding="30" width="100%" summary="main text" >
<tr><td>
<ol>';
for ($i = 0; $i <= 8; $i++) {
$chapter1 = 100 * $i;
if (!isset ($tit[$chapter1])) { continue; }
$out .= '<a name="'.'ank'.$chapter1.'"><li value="'.$i.'" >
<h3 id="chap'.$chapter1.'-title" class="handcursor"> '.$tit[$chapter1].' </h3>
<div id="chap'.$chapter1.'" class="switchgroup1"></a>';
if (isset ($a[$chapter1])) { $out .= $a[$chapter1]; }
$out .= '<ol>';
for ($j = 1; $j <= 9; $j++) {
$chapter2 = $chapter1 + 10 * $j;
if (!isset ($tit[$chapter2])) { continue; }
$out .= '<a name="'.'ank'.$chapter2.'"><li>
<h3 id="chap'.$chapter2.'-title" class="handcursor"> '.$tit[$chapter2].' </h3>
<div id="chap'.$chapter2.'" class="switchgroup1"></a>';
if (isset ($b[$chapter2])) {
$out .= $b[$chapter2] .' ';
} else {
$out .= '<div style="background-color:#fff8ae">' .
$t['no_translation'] . ' </div>';
}
$out .= '<ol>';
for ($k = 1; $k <= 9; $k++) {
$chapter3 = $chapter2 + $k;
if (!isset ($tit[$chapter3])) { continue; }
$out .= '<a name="'.'ank'.$chapter3.'"><li>
<h3 id="chap'.$chapter3.'-title" class="handcursor"> '.$tit[$chapter3].' </h3>
<div id="chap'.$chapter3.'" class="switchgroup1"></a>';
if (isset ($c[$chapter3])) {
$out .= $c[$chapter3] .' </div>';
} else {
$out .= '<div style="background-color:#fff8ae">' .
$t['no_translation'] .' </div>';
}
}
$out .= '</ol>';
if (isset ($b[$chapter2 + 1])) { $out .= $b[$chapter2 + 1]; }
$out .= '</div>';
}
$out .= '</ol>';
}
$out .= '</ol> </table> </tr>';
echo $out;
echo '<script type="text/javascript">
var all=new switchcontent("switchgroup1", "div")
//all.setStatus(\'closed\', \'opened\')
all.setStatus(\'\', \'\')
//all.setColor(\'darkred\', \'black\')
//all.setColor(\'darkblue\', \'darkblue\')
all.setColor(\'#52557b\', \'#5d608c\')
all.setPersist(true)
all.collapsePrevious(false) //Only one content open at any given time
all.init()
var adn=new switchcontent("switchgroup2", "span")
//adn.setStatus(\'less ...\', \'more ...\')
adn.setStatus("", "")
adn.setColor(\'blue\', \'blue\')
adn.collapsePrevious(false)
//adn.setPersist(false)
adn.defaultExpanded()
adn.init()
</script>';
echo $tail;
}
And this is the way I try to jump into <div - sections which appears in the Table of content as it is seen in http://zbyszek.evot.org/ebs/index.php . Actually the version on the www server is not corrected yet.
Code:
function contents () {
global $tit, $t;
$cont = '<ol>';
for ($i = 0; $i <= 9; $i++) {
$n = 100 * $i;
if (isset ($tit[$n])) {
$cont = $cont . '<li value="'.$i.'" ><a href="index.php#ank'.$n.'" onClick="all.expandcontent( document.getElementById(chap'.$n.'-title))" >'.$tit[$n].'</a>';
$cont = $cont . '<div><ol>';
for ($j = 1; $j <= 9; $j++) {
$m = $n + 10 * $j;
if (isset ($tit[$m])) {
$cont = $cont . '<li><a href="index.php#ank'.$m.'" onClick="all.expandcontent( document.getElementById(chap'.$n.'-title)); all.expandcontent( document.getElementById(chap'.$m.'-title))" >'.$tit[$m].'</a>';
$cont = $cont . '<div><ol>';
for ($k = 1; $k <= 9; $k++) {
$r = $m + $k;
if (isset ($tit[$r])) {
$cont = $cont . '<li><a href="index.php#ank'.$r.'" onClick="all.expandcontent( document.getElementById(chap'.$n.'-title)); all.expandcontent( document.getElementById(chap'.$m.'-title)); all.expandcontent( document.getElementById(chap'.$r.'-title))" >'.$tit[$r].'</a>';
}
}
$cont = $cont . '</ol></div>';
}
...
All this works well if switchcontent <div-sections are all opened.
Bookmarks