Collapsible Frame JavaScript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • books1999

    Collapsible Frame JavaScript

    I have framset with leftFrame, mainFrame, TopFrame.

    I found this script :


    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

    #2
    Re: Collapsible Frame JavaScript

    books1999 <books1999@hotm ail.com> wrote in message
    news:1116888529 .364751.176750@ g44g2000cwa.goo glegroups.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.b ody)parent.docu ment.body.rows= "*,0"'>Collapse <
    /A>

    <A
    HREF='#'onclick ='if(document.b ody)parent.docu ment.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.bod y)
    document.write( ....)

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

    547265617375726 520627572696564 206174204F2E532 E207265663A2054 51323437393134





    Comment

    • books1999

      #3
      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><nofra mes></noframes>

      Comment

      • Stephen Chalmers

        #4
        Re: Collapsible Frame JavaScript

        books1999 <books1999@hotm ail.com> wrote in message
        news:1116896107 .614943.250660@ g47g2000cwa.goo glegroups.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><nofra mes></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(doc ument.body){var
        fc=parent.docum ent.body.cols; parent.document .body.cols=(fc= ="230,*" ?
        "5,*" : "230,*");}' >Collapse/Restore</A>

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

        547265617375726 520627572696564 206174204F2E532 E207265663A2054 5132343739
        3134



        Comment

        • books1999

          #5
          Re: Collapsible Frame JavaScript

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

          <A HREF='#' onclick='if(doc ument.body){var
          fc=parent.docum ent.body.cols; parent.document .body.cols=(fc= ­="230,*"
          ? "5,*" : "230,*");}'>Col lapse/Restore</A>


          Can you please tell me what is wrong with it?

          Comment

          • Logic Al

            #6
            Re: Collapsible Frame JavaScript

            books1999 <books1999@hotm ail.com> wrote in message
            news:1116948362 .576712.89890@f 14g2000cwb.goog legroups.com...
            Stephen this link reports an invalid character error and it does not
            collapse the frame.

            <A HREF='#' onclick='if(doc ument.body){var
            fc=parent.docum ent.body.cols;
            parent.document .body.cols=(fc= ­="230,*"
            ? "5,*" : "230,*");}'>Col lapse/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

            547265617375726 520627572696564 206174204F2E532 E207265663A2054 5132343739
            3134




            Comment

            • books1999

              #7
              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?

              Comment

              • books1999

                #8
                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?

                Comment

                • Lasse Reichstein Nielsen

                  #9
                  Re: Collapsible Frame JavaScript

                  "Logic Al" <ignoring@lycos .co.uk> writes:
                  [color=blue]
                  > books1999 <books1999@hotm ail.com> wrote in message
                  > news:1116948362 .576712.89890@f 14g2000cwb.goog legroups.com...[/color]
                  [color=blue]
                  > Stephen this link reports an invalid character error and it does not
                  > collapse the frame.
                  >
                  > <A HREF='#' onclick='if(doc ument.body){var
                  > fc=parent.docum ent.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,*");}'>Col lapse/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(doc ument.body){
                  parent.document .body.cols =
                  (parent.documen t.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/rasterTriangleD OM.html>
                  'Faith without judgement merely degrades the spirit divine.'

                  Comment

                  • books1999

                    #10
                    Re: Collapsible Frame JavaScript

                    Same problem with Lasse's example.

                    All the frames end up in the top frame.

                    Thanks!

                    Comment

                    Working...