473,320 Members | 1,845 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Collapsible Frame JavaScript

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!

Jul 23 '05 #1
9 3490
books1999 <bo*******@hotmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
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.


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

Jul 23 '05 #2
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>

Jul 23 '05 #3
books1999 <bo*******@hotmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
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>

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

Jul 23 '05 #4
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?

Jul 23 '05 #5
books1999 <bo*******@hotmail.com> wrote in message
news:11*********************@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


Jul 23 '05 #6
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?

Jul 23 '05 #7
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?

Jul 23 '05 #8
"Logic Al" <ig******@lycos.co.uk> writes:
books1999 <bo*******@hotmail.com> wrote in message
news:11*********************@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,*" ^
There is an extra "-" between the two ='s, that shouldn't be there,
i.e., "=-=" should be just "==".
? "5,*" : "230,*");}'>Collapse/Restore</A> Can you please tell me what is wrong with it?
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,*';
}">
I told you to put it all on one line, not wrapped as it may appear.


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

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #9
Same problem with Lasse's example.

All the frames end up in the top frame.

Thanks!

Jul 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: clintonG | last post by:
Can somebody direct me to documents or source that supports the use of collapsible content that is collapsed by default when the page is loaded? The secondary objective would of course be...
2
by: develeigh | last post by:
Hi, I have got this Collapsible Menus, it uses combination of JavaScript and CSS. Javascript when executed changes the inital CSS settings to make the sub menu visable function...
1
by: mike | last post by:
The JavaScript below works fine for expandable/collapsible menus in IE, but Firefox 1.5 complains: "Error: loc.parentNode.nextSibling has no properties" and highlights the line...
2
by: pantagruel | last post by:
Hi, I'm wondering if CSS support in IE is such that one could make an expandable collapsible vertical menu - such as in a TOC - without using Javascript that will work in at least IE 6. IE 5...
5
by: Jonathan | last post by:
Hello All, I am in the process of creating a 2/3 level collapsible/exspanible menu (called "nav") where users can click on a category and have the submenus appear beneath it and so on (allow...
7
by: Kamal | last post by:
Hello all, I have a very simple html table with collapsible rows and sorting capabilities. The collapsible row is hidden with css rule (display:none). When one clicks in the left of the...
7
by: David T. Ashley | last post by:
I'm trying to implement these ... I know there is a lot of example code on the web, but I'm trying to roll my own ... What JavaScript functionality is typically used to display parts of the...
5
by: ting ting | last post by:
I am working on a ASP.net 2.0 version and I want to click a button to open a window. I was using window.open to write at vb side. Response.Write("<Script...
1
by: mahesh123 | last post by:
I am using Collapsible Panel in my project.But in other form of my project i want to use collapsible panel inside other Collapsible panel.Is it possible. Both panels are to be dinamic.Is it possible...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.