T
Tony Strazzeri
Repeat posting.
I found some help to create a collapsible list in the group a while
back which I used.
-------------------------------------------------------
see:
http://groups.google.co.uk/group/mi...ders"+frontpage&rnum=2&hl=en#bded950612b53956
-------------------------------------------------------
I am wondering if someone could help me with a couple of small
enhancements.
I am a competent programmer in general but do not have any experience
in web
scripting (Javasrcipt?). I have worked out how to have one of the
sections
start in expanded mode.
Now I want to modify the code do the following two things
1. I would like to scroll the page so that the newly expanded text is
at the
top of the page. Is this possible?
I think this may be possible by passing a bookmark to the procedure and
have it go to the specified bookmark. Alternatively (simpler?) would
be to scroll the page so the start of the expanded list item is at the
top.
2. I will be adding additional sections in the future. From what I see,
the
selected section is expanded and each of the other sections is called
at each
point to un-expand it. This makes the code rather unwieldily for large
numbers of sections/points. Is it possible to define an array with all
of the
section names so that the FP_changeProp only needs to be sent the name
of the
section to be expanded and have it traverse the array to un-expand all
of the
others?
It seems to me that both of these features should be fairly simple but
beyond me at the moment. I hope someone can help me with this.
Cheers
TonyS.
---------
The function is called with:
<a href="#"
onclick="FP_changeProp(/*id*/'sub_Present',1,'style.display','block','bm_Present');
FP_changeProp(/*id*/'sub_FutureSoon',1,'style.display','none');
FP_changeProp(/*id*/'sub_FutureLong',1,'style.display','none')">
---------
The modified function is:
function FP_changeProp()
{ //v1.0
var
args=arguments,d=document,i,j,id=args[0],o=FP_getObjectByID(id),s,ao,v,x;
d.$cpe=new Array();
if(o)
for(i=2; i<args.length; i+=2)
{ v=args[i+1]; s="o";
ao=args.split(".");
for(j=0; j<ao.length; j++)
{
s+="."+ao[j];
if(null==eval(s))
{
s=null; break;
}
}
x=new Object;
x.o=o;
x.n=new Array();
x.v=new Array();
x.n[x.n.length]=s; // Why is this different to below (ie not
using
eval)?
eval("x.v[x.v.length]="+s); //Is this clearing the x.v array
because s
is null?
d.$cpe[d.$cpe.length]=x;
if(s) eval(s+"=v");
}
}
I found some help to create a collapsible list in the group a while
back which I used.
-------------------------------------------------------
see:
http://groups.google.co.uk/group/mi...ders"+frontpage&rnum=2&hl=en#bded950612b53956
-------------------------------------------------------
I am wondering if someone could help me with a couple of small
enhancements.
I am a competent programmer in general but do not have any experience
in web
scripting (Javasrcipt?). I have worked out how to have one of the
sections
start in expanded mode.
Now I want to modify the code do the following two things
1. I would like to scroll the page so that the newly expanded text is
at the
top of the page. Is this possible?
I think this may be possible by passing a bookmark to the procedure and
have it go to the specified bookmark. Alternatively (simpler?) would
be to scroll the page so the start of the expanded list item is at the
top.
2. I will be adding additional sections in the future. From what I see,
the
selected section is expanded and each of the other sections is called
at each
point to un-expand it. This makes the code rather unwieldily for large
numbers of sections/points. Is it possible to define an array with all
of the
section names so that the FP_changeProp only needs to be sent the name
of the
section to be expanded and have it traverse the array to un-expand all
of the
others?
It seems to me that both of these features should be fairly simple but
beyond me at the moment. I hope someone can help me with this.
Cheers
TonyS.
---------
The function is called with:
<a href="#"
onclick="FP_changeProp(/*id*/'sub_Present',1,'style.display','block','bm_Present');
FP_changeProp(/*id*/'sub_FutureSoon',1,'style.display','none');
FP_changeProp(/*id*/'sub_FutureLong',1,'style.display','none')">
---------
The modified function is:
function FP_changeProp()
{ //v1.0
var
args=arguments,d=document,i,j,id=args[0],o=FP_getObjectByID(id),s,ao,v,x;
d.$cpe=new Array();
if(o)
for(i=2; i<args.length; i+=2)
{ v=args[i+1]; s="o";
ao=args.split(".");
for(j=0; j<ao.length; j++)
{
s+="."+ao[j];
if(null==eval(s))
{
s=null; break;
}
}
x=new Object;
x.o=o;
x.n=new Array();
x.v=new Array();
x.n[x.n.length]=s; // Why is this different to below (ie not
using
eval)?
eval("x.v[x.v.length]="+s); //Is this clearing the x.v array
because s
is null?
d.$cpe[d.$cpe.length]=x;
if(s) eval(s+"=v");
}
}