Help me find my lost code!

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

    Help me find my lost code!

    Hello:

    I had some code that allowed me to expand a paragraph by clicking on a
    hyperlink and collapse it by clicking on the paragraph. I unfortunately the
    Javascript function. I still have the code that calls it

    Here is how the calling paragraph looks:

    <div id="menu7"><A HREF="" onclick="return ExpandHideConte nt('menu1','i7' ,
    'c7')">Hyperlin k that displays when page first viewed</A></div>
    <div id="i7"><BR>
    <A HREF="" onclick="return ExpandHideConte nt('menu1','i7' , 'c7')"><IMG
    SRC="CollapseBe lowContent.gif" BORDER=0></A>

    <P>CONTENT</P>

    <A HREF="" onclick="return ExpandHideConte nt('menu1','i7' , 'c7')"><IMG
    SRC="graphics/CollapseAboveCo ntent.gif" BORDER=0></A><BR>
    </div>

    There are a series of sections like this, so when you open the page you just
    see a list of hyperlinks. You click on the hyperlink, it shows everything in
    the code below (plus all the original hyperlinks stay there, i.e.:

    Hyperlink1
    Hyperlink2
    Hyperlink3

    click on hyperlink1 and you get:
    Hyperlink1
    Content
    Hyperlink2
    Hyperlink3


    You click on the content or the .gifs and the content disappears..

    The "ExpandHideCont ent" function was pretty simple, but I can't remember
    what it was, and I'm feeling too busy to figure it out. The gifs basically
    are funky text that say what the filenames imply.

    Can someone help?

    Blair




  • Kayda

    #2
    Re: Help me find my lost code!

    Actually, I found my code with a Google Groups search. The code is below,
    but when I click on the hyperlink it briefly shows the content and then
    sends me to the site's homepage. Any ideas?

    <SCRIPT LANGUAGE="JavaS cript">


    var counter1 = 0;
    var counter2 = 0;
    var counter3 = 0;
    var counter4 = 0;
    var counter5 = 0;
    var counter6 = 0;
    var counter7 = 0;

    function ExpandHideConte nt(the_id, the_iframe, the_counter)
    {
    if (the_counter == "c1") { ++counter1; }
    if (the_counter == "c2") { ++counter2; }
    if (the_counter == "c3") { ++counter3; }
    if (the_counter == "c4") { ++counter4; }
    if (the_counter == "c5") { ++counter5; }
    if (the_counter == "c6") { ++counter6; }
    if (the_counter == "c7") { ++counter7; }

    ifrm = document.getEle mentById(the_if rame);

    if (counter1 == 1)
    {
    counter1++;
    ifrm.style.disp lay = "block";
    return;
    }
    if (counter2 == 1)
    {
    counter2++;
    ifrm.style.disp lay = "block";
    return;
    }
    if (counter3 == 1)
    {
    counter3++;
    ifrm.style.disp lay = "block";
    return;
    }

    if (counter4 == 1)
    {
    counter4++;
    ifrm.style.disp lay = "block";
    return;
    }
    if (counter5 == 1)
    {
    counter5++;
    ifrm.style.disp lay = "block";
    return;
    }
    if (counter6 == 1)
    {
    counter6++;
    ifrm.style.disp lay = "block";
    return;
    }

    if (counter7 == 1)
    {
    counter7++;
    ifrm.style.disp lay = "block";
    return;
    }


    if (ifrm.style.dis play == "none")
    {
    //alert(ifrm.styl e.display);
    ifrm.style.disp lay = "block";
    }
    else
    {
    //alert(ifrm.styl e.display);
    ifrm.style.disp lay = "none";
    }

    }
    </SCRIPT>
    "Kayda" <blair863@hotma il.com> wrote in message
    news:dpqdnWpyAr V33u_dRVn-iQ@comcast.com. ..[color=blue]
    > Hello:
    >
    > I had some code that allowed me to expand a paragraph by clicking on a
    > hyperlink and collapse it by clicking on the paragraph. I unfortunately[/color]
    the[color=blue]
    > Javascript function. I still have the code that calls it
    >
    > Here is how the calling paragraph looks:
    >
    > <div id="menu7"><A HREF="" onclick="return ExpandHideConte nt('menu1','i7' ,
    > 'c7')">Hyperlin k that displays when page first viewed</A></div>
    > <div id="i7"><BR>
    > <A HREF="" onclick="return ExpandHideConte nt('menu1','i7' , 'c7')"><IMG
    > SRC="CollapseBe lowContent.gif" BORDER=0></A>
    >
    > <P>CONTENT</P>
    >
    > <A HREF="" onclick="return ExpandHideConte nt('menu1','i7' , 'c7')"><IMG
    > SRC="graphics/CollapseAboveCo ntent.gif" BORDER=0></A><BR>
    > </div>
    >
    > There are a series of sections like this, so when you open the page you[/color]
    just[color=blue]
    > see a list of hyperlinks. You click on the hyperlink, it shows everything[/color]
    in[color=blue]
    > the code below (plus all the original hyperlinks stay there, i.e.:
    >
    > Hyperlink1
    > Hyperlink2
    > Hyperlink3
    >
    > click on hyperlink1 and you get:
    > Hyperlink1
    > Content
    > Hyperlink2
    > Hyperlink3
    >
    >
    > You click on the content or the .gifs and the content disappears..
    >
    > The "ExpandHideCont ent" function was pretty simple, but I can't remember
    > what it was, and I'm feeling too busy to figure it out. The gifs basically
    > are funky text that say what the filenames imply.
    >
    > Can someone help?
    >
    > Blair
    >
    >
    >
    >[/color]


    Comment

    • Ivo

      #3
      Re: Help me find my lost code!

      "Kayda" <blair863@hotma il.com> wrote[color=blue]
      > but when I click on the hyperlink it briefly shows the content and then
      > sends me to the site's homepage. Any ideas?
      >
      > <SCRIPT LANGUAGE="JavaS cript">[/color]

      The language attribute should not be used. Use type="text/javascript"
      instead. This is required for validation, but won't solve the problem.

      <snip lots of global variables>
      [color=blue]
      > function ExpandHideConte nt(the_id, the_iframe, the_counter)
      > ifrm = document.getEle mentById(the_if rame);
      >
      > if (counter1 == 1)
      > {
      > counter1++;
      > ifrm.style.disp lay = "block";
      > return;[/color]

      Change this line (and the other lines in the function) to:
      return FALSE; // capitalization is optional

      <snip more code>
      [color=blue]
      > </SCRIPT>[color=green]
      > > <div id="menu7"><A HREF="" onclick="return[/color][/color]
      ExpandHideConte nt('menu1','i7' ,[color=blue][color=green]
      > > 'c7')">Hyperlin k that displays when page first viewed</A></div>[/color][/color]

      and follows the href when clicked. The called function should return false
      in order to prevent the href from being followed. Currently it returns, but
      not false.
      HTH
      Ivo



      Comment

      • Ivo

        #4
        Re: Help me find my lost code!

        "Kayda" <blair863@hotma il.com> wrote[color=blue]
        > but when I click on the hyperlink it briefly shows the content and then
        > sends me to the site's homepage. Any ideas?
        >
        > <SCRIPT LANGUAGE="JavaS cript">[/color]

        The language attribute should not be used. Use type="text/javascript"
        instead. This is required for validation, but won't solve the problem.

        <snip lots of global variables>
        [color=blue]
        > function ExpandHideConte nt(the_id, the_iframe, the_counter)
        > ifrm = document.getEle mentById(the_if rame);
        >
        > if (counter1 == 1)
        > {
        > counter1++;
        > ifrm.style.disp lay = "block";
        > return;[/color]

        Change this line (and the other lines in the function) to:
        return FALSE; // capitalization is optional

        <snip more code>
        [color=blue]
        > </SCRIPT>[color=green]
        > > <div id="menu7"><A HREF="" onclick="return[/color][/color]
        ExpandHideConte nt('menu1','i7' ,[color=blue][color=green]
        > > 'c7')">Hyperlin k that displays when page first viewed</A></div>[/color][/color]

        and follows the href when clicked. The called function should return false
        in order to prevent the href from being followed. Currently it returns, but
        not false.
        HTH
        Ivo




        Comment

        • Kayda

          #5
          Re: Help me find my lost code!

          That made perfect sense, but it seems it is still going to the homepage when
          I click on the links. You see the content for a split second, but then
          returns to the homepage.

          Did you mean to change something in the calling hyperlink, or just put the
          "return FALSE" in the code?

          Thanks,
          Blair

          "Ivo" <no@thank.you > wrote in message
          news:4072a3ea$0 $93583$abc4f4c3 @news.wanadoo.n l...[color=blue]
          > "Kayda" <blair863@hotma il.com> wrote[color=green]
          > > but when I click on the hyperlink it briefly shows the content and then
          > > sends me to the site's homepage. Any ideas?
          > >
          > > <SCRIPT LANGUAGE="JavaS cript">[/color]
          >
          > The language attribute should not be used. Use type="text/javascript"
          > instead. This is required for validation, but won't solve the problem.
          >
          > <snip lots of global variables>
          >[color=green]
          > > function ExpandHideConte nt(the_id, the_iframe, the_counter)
          > > ifrm = document.getEle mentById(the_if rame);
          > >
          > > if (counter1 == 1)
          > > {
          > > counter1++;
          > > ifrm.style.disp lay = "block";
          > > return;[/color]
          >
          > Change this line (and the other lines in the function) to:
          > return FALSE; // capitalization is optional
          >
          > <snip more code>
          >[color=green]
          > > </SCRIPT>[color=darkred]
          > > > <div id="menu7"><A HREF="" onclick="return[/color][/color]
          > ExpandHideConte nt('menu1','i7' ,[color=green][color=darkred]
          > > > 'c7')">Hyperlin k that displays when page first viewed</A></div>[/color][/color]
          >
          > and follows the href when clicked. The called function should return false
          > in order to prevent the href from being followed. Currently it returns,[/color]
          but[color=blue]
          > not false.
          > HTH
          > Ivo
          >
          >
          >
          >[/color]


          Comment

          • Michael Winter

            #6
            Re: Help me find my lost code!

            On Tue, 6 Apr 2004 14:34:19 +0200, Ivo <no@thank.you > wrote:

            [snip]
            [color=blue][color=green]
            >> return;[/color]
            >
            > Change this line (and the other lines in the function) to:
            > return FALSE; // capitalization is optional[/color]

            No it's not; the case of the false keyword is, and can only be, lowercase.
            If any of the characters are uppercase, the JavaScript interpreter will
            try to find a variable of that name and capitalisation.

            [snip]

            Mike

            --
            Michael Winter
            M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)

            Comment

            • Ivo

              #7
              Re: Help me find my lost code!

              "Kayda" <blair863@hotma il.com> wrote[color=blue]
              > but when I click on the hyperlink it briefly shows the content and then
              > sends me to the site's homepage. Any ideas?
              >
              > <SCRIPT LANGUAGE="JavaS cript">[/color]

              The language attribute should not be used. Use type="text/javascript"
              instead. This is required for validation, but won't solve the problem.

              <snip lots of global variables>
              [color=blue]
              > function ExpandHideConte nt(the_id, the_iframe, the_counter)
              > ifrm = document.getEle mentById(the_if rame);
              >
              > if (counter1 == 1)
              > {
              > counter1++;
              > ifrm.style.disp lay = "block";
              > return;[/color]

              Change this line (and the other lines in the function) to:
              return FALSE; // capitalization is optional

              <snip more code>
              [color=blue]
              > </SCRIPT>[color=green]
              > > <div id="menu7"><A HREF="" onclick="return[/color][/color]
              ExpandHideConte nt('menu1','i7' ,[color=blue][color=green]
              > > 'c7')">Hyperlin k that displays when page first viewed</A></div>[/color][/color]

              and follows the href when clicked. The called function should return false
              in order to prevent the href from being followed. Currently it returns, but
              not false.
              HTH
              Ivo




              Comment

              • Lasse Reichstein Nielsen

                #8
                Re: Help me find my lost code!

                "Ivo" <no@thank.you > writes:
                [color=blue]
                > return FALSE; // capitalization is optional[/color]

                Nope, Javascript is case sensitive. "FALSE" is an unknown variable,
                while "false" is syntax for a boolean value.

                /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

                • Kayda

                  #9
                  Re: Help me find my lost code!

                  Right you both are Lasse and Michael. It works now thanks.

                  Blair

                  "Lasse Reichstein Nielsen" <lrn@hotpop.com > wrote in message
                  news:7jwrek2t.f sf@hotpop.com.. .[color=blue]
                  > "Ivo" <no@thank.you > writes:
                  >[color=green]
                  > > return FALSE; // capitalization is optional[/color]
                  >
                  > Nope, Javascript is case sensitive. "FALSE" is an unknown variable,
                  > while "false" is syntax for a boolean value.
                  >
                  > /L
                  > --
                  > Lasse Reichstein Nielsen - lrn@hotpop.com
                  > DHTML Death Colors:[/color]
                  <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>[color=blue]
                  > 'Faith without judgement merely degrades the spirit divine.'[/color]


                  Comment

                  Working...