Connecting Tech Pros Worldwide Forums | Help | Site Map

Collapsible Frame JavaScript

books1999
Guest
 
Posts: n/a
#1: Jul 23 '05
I have framset with leftFrame, mainFrame, TopFrame.

I found this script :
http://www.dynamicdrive.com/dynamici...llapsemain.htm

I wonder if it could be ajusted so that it collapses the same frame
that calls it. As it is, If I put the function in the left frame it
decreases the size of the topFrame. I want it to collaps itself.

Is this doable, if not could you please point me to some other resource
where I could do it.

Thanks!


Stephen Chalmers
Guest
 
Posts: n/a
#2: Jul 23 '05

re: Collapsible Frame JavaScript


books1999 <books1999@hotmail.com> wrote in message
news:1116888529.364751.176750@g44g2000cwa.googlegr oups.com...[color=blue]
> I have framset with leftFrame, mainFrame, TopFrame.
>
> I found this script :
> http://www.dynamicdrive.com/dynamici...llapsemain.htm
>
> I wonder if it could be ajusted so that it collapses the same frame
> that calls it.[/color]

If that's all you want to do, you don't need a stand-alone script, just
insert the necessary code into a suitable link.
These two examples should collapse the lower or rightmost of a pair of
frames respectively, and can be located in either.

<A
HREF='#'onclick='if(document.body)parent.document. body.rows="*,0"'>Collapse<
/A>

<A
HREF='#'onclick='if(document.body)parent.document. body.cols="*,0"'>Collapse<
/A>

I don't know why you'd want to do this, but I suggest you include a
restorative link in the remaining visible frame. The syntax should be
obvious.
Another refinement would be to generate the links with document.write, so
that they don't appear if script is disabled or the required support is
un-available.

if(document.body)
document.write(....)

--
Stephen Chalmers http://makeashorterlink.com/?H3E82245A

547265617375726520627572696564206174204F2E532E2072 65663A205451323437393134





books1999
Guest
 
Posts: n/a
#3: Jul 23 '05

re: Collapsible Frame JavaScript


Ok here is what I want in a bit more detail.
I want to put a click link in the <frame name=menuFrame src="menu.cfm"
scrolling="no"> so that this frame becomes 5 pixels and when i click it
again it should become 230 as it is when the page loads. Can you please
tell me how this is done becauase my JS is null?


<frameset border="0" rows="24,*" frameBorder="no" frameSpacing="0">
<frame name=TopFrame src="top.cfm" noresize scrolling="no">

<frameset border="0" cols="230,*" frameBorder="no" frameSpacing="0">
<frame name=menuFrame src="menu.cfm" scrolling="no">
<frame name=mainFrame src="main.cfm">

</frameset>
</frameset><noframes></noframes>

Stephen Chalmers
Guest
 
Posts: n/a
#4: Jul 23 '05

re: Collapsible Frame JavaScript


books1999 <books1999@hotmail.com> wrote in message
news:1116896107.614943.250660@g47g2000cwa.googlegr oups.com...[color=blue]
> Ok here is what I want in a bit more detail.
> I want to put a click link in the <frame name=menuFrame[/color]
src="menu.cfm"[color=blue]
> scrolling="no"> so that this frame becomes 5 pixels and when i click[/color]
it[color=blue]
> again it should become 230 as it is when the page loads. Can you[/color]
please[color=blue]
> tell me how this is done becauase my JS is null?
>
>
> <frameset border="0" rows="24,*" frameBorder="no" frameSpacing="0">
> <frame name=TopFrame src="top.cfm" noresize scrolling="no">
>
> <frameset border="0" cols="230,*" frameBorder="no" frameSpacing="0">
> <frame name=menuFrame src="menu.cfm" scrolling="no">
> <frame name=mainFrame src="main.cfm">
>
> </frameset>
> </frameset><noframes></noframes>
>[/color]
This link saves including a separate script, at the expense of having
to modify it if you change the default frame sizes.
Put it in the body of either document (all on one line), but if you
put it in the collapsing frame as you describe, I forsee a possible
operability issue...

<A HREF='#' onclick='if(document.body){var
fc=parent.document.body.cols; parent.document.body.cols=(fc=="230,*" ?
"5,*" : "230,*");}' >Collapse/Restore</A>

--
Stephen Chalmers http://makeashorterlink.com/?H3E82245A

547265617375726520627572696564206174204F2E532E2072 65663A20545132343739
3134



books1999
Guest
 
Posts: n/a
#5: Jul 23 '05

re: Collapsible Frame JavaScript


Stephen this link reports an invalid character error and it does not
collapse the frame.

<A HREF='#' onclick='if(document.body){var
fc=parent.document.body.cols; parent.document.body.cols=(fc=*="230,*"
? "5,*" : "230,*");}'>Collapse/Restore</A>


Can you please tell me what is wrong with it?

Logic Al
Guest
 
Posts: n/a
#6: Jul 23 '05

re: Collapsible Frame JavaScript


books1999 <books1999@hotmail.com> wrote in message
news:1116948362.576712.89890@f14g2000cwb.googlegro ups.com...
Stephen this link reports an invalid character error and it does not
collapse the frame.

<A HREF='#' onclick='if(document.body){var
fc=parent.document.body.cols;
parent.document.body.cols=(fc=*="230,*"
? "5,*" : "230,*");}'>Collapse/Restore</A>


Can you please tell me what is wrong with it?

I told you to put it all on one line, not wrapped as it may appear.
Using the example in this message, remove the newlines and ensure no
words become joined together

--
Stephen Chalmers http://makeashorterlink.com/?H3E82245A

547265617375726520627572696564206174204F2E532E2072 65663A20545132343739
3134




books1999
Guest
 
Posts: n/a
#7: Jul 23 '05

re: Collapsible Frame JavaScript


Hi Stephen,

I originaly put it in one line but the mistake was in a minus sign that
I accidetnaly put when i removed the newlines.

Now here is the problem. When I clicked on the link, it put all the
frames, all three of them in the top frame! plus creating one more.

Do you know what might be the problem?

books1999
Guest
 
Posts: n/a
#8: Jul 23 '05

re: Collapsible Frame JavaScript


Hi Stephen,

I originaly put it in one line but the mistake was in a minus sign that
I accidetnaly put when i removed the newlines.

Now here is the problem. When I clicked on the link, it put all the
frames, all three of them in the top frame! plus creating one more.

Do you know what might be the problem?

Lasse Reichstein Nielsen
Guest
 
Posts: n/a
#9: Jul 23 '05

re: Collapsible Frame JavaScript


"Logic Al" <ignoring@lycos.co.uk> writes:
[color=blue]
> books1999 <books1999@hotmail.com> wrote in message
> news:1116948362.576712.89890@f14g2000cwb.googlegro ups.com...[/color]
[color=blue]
> Stephen this link reports an invalid character error and it does not
> collapse the frame.
>
> <A HREF='#' onclick='if(document.body){var
> fc=parent.document.body.cols;
> parent.document.body.cols=(fc=*="230,*"[/color]
^
There is an extra "-" between the two ='s, that shouldn't be there,
i.e., "=-=" should be just "==".
[color=blue]
> ? "5,*" : "230,*");}'>Collapse/Restore</A>[/color]
[color=blue]
> Can you please tell me what is wrong with it?[/color]

It should be a button, not a link. Links are for linking to content,
buttons for doing things (but that's a usability problem, not a
programming error :).

There is no need to define a variable if the value is only used once.

Try just:

<button type="button" value="Collapse/Restore"
onclick="if(document.body){
parent.document.body.cols =
(parent.document.body.cols == '230,*') ? '5,*' : '230,*';
}">
[color=blue]
> I told you to put it all on one line, not wrapped as it may appear.[/color]

Attributes can contain newlines, so it doesn't need to be one line.

/L
--
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
books1999
Guest
 
Posts: n/a
#10: Jul 23 '05

re: Collapsible Frame JavaScript


Same problem with Lasse's example.

All the frames end up in the top frame.

Thanks!

Closed Thread