select fullrow

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

    #1

    select fullrow

    Hi all

    Looking for a way to select the fullrow when i click on LAG 3
    So it marks all of LAG 3 for July, August, September

    If I select LAG 4 it'll select of LAG 4 in the different months

    It would very nice if there is a way with Javascript
    Follow the link below




    I'am pretty good with Visual Basic 6, and html
    But no experience with Javascript
    --

    Mvh
    Jon

    jonny.hakansson @comhem.se


  • Ivo

    #2
    Re: select fullrow

    "Jon" typed[color=blue]
    > Looking for a way to select the fullrow when i click on LAG 3
    > So it marks all of LAG 3 for July, August, September
    > If I select LAG 4 it'll select of LAG 4 in the different months
    >
    > It would very nice if there is a way with Javascript
    > Follow the link below
    > http://www.johak.se/schema/index.html
    >[/color]

    For example:
    <script type="text/javascript">
    function hiliteTR(el) {
    var cel=el.cells;
    var c=cel[0].style.backgrou nd;
    for (var i=cel.length;i--;)
    cel[i].style.backgrou nd= (c=='gold') ? 'none' : 'gold';
    }
    </script>

    This function can be called by adding a so-called onclick event handler,
    either to the whole TR or on the first TD only, like so:
    <tr onclick="hilite TR(this)"><td>t ada</td><td>tada</td></tr>
    <tr><td onclick="hilite TR(this.parentN ode)">tada</td><td>tada</td></tr>

    HTH
    Ivo


    Comment

    • Jon

      #3
      Re: select fullrow

      Ok

      Yes it worked perfectly.

      But I need it too work on several rows at the sametime

      Everytime I click on LAG 1, the row that start's with LAG 1
      will be highlighted.





      "Ivo" <no@thank.you > skrev i meddelandet
      news:40bdeb8a$0 $153$18b6e80@ne ws.wanadoo.nl.. .[color=blue]
      > "Jon" typed[color=green]
      > > Looking for a way to select the fullrow when i click on LAG 3
      > > So it marks all of LAG 3 for July, August, September
      > > If I select LAG 4 it'll select of LAG 4 in the different months
      > >
      > > It would very nice if there is a way with Javascript
      > > Follow the link below
      > > http://www.johak.se/schema/index.html
      > >[/color]
      >
      > For example:
      > <script type="text/javascript">
      > function hiliteTR(el) {
      > var cel=el.cells;
      > var c=cel[0].style.backgrou nd;
      > for (var i=cel.length;i--;)
      > cel[i].style.backgrou nd= (c=='gold') ? 'none' : 'gold';
      > }
      > </script>
      >
      > This function can be called by adding a so-called onclick event handler,
      > either to the whole TR or on the first TD only, like so:
      > <tr onclick="hilite TR(this)"><td>t ada</td><td>tada</td></tr>
      > <tr><td onclick="hilite TR(this.parentN ode)">tada</td><td>tada</td></tr>
      >
      > HTH
      > Ivo
      >
      >[/color]


      Comment

      • Ivo

        #4
        Re: select fullrow

        "Jon" wrote[color=blue]
        > "Ivo" skrev[color=green]
        > > "Jon" typed[color=darkred]
        > > > Looking for a way to select the fullrow when i click on LAG 3
        > > > So it marks all of LAG 3 for July, August, September
        > > > If I select LAG 4 it'll select of LAG 4 in the different months
        > > >
        > > > It would very nice if there is a way with Javascript
        > > > Follow the link below
        > > > http://www.johak.se/schema/index.html
        > > >[/color][/color][/color]
        <snip script>[color=blue]
        >
        > Yes it worked perfectly.
        > But I need it too work on several rows at the sametime
        >[/color]

        I see. The following function does that (it also sets the background on the
        TR deirectly and not on its TD's separately as did the previous function for
        no good reason):

        function hiliteTR(el) {
        var col= (el.style.backg round=='gold') ? 'none' : 'gold';
        var r=0; while(el=el.pre viousSibling) r++;
        var t=document.getE lementsByTagNam e('table');
        for(var i=t.length; i--; ) t[i].rows[r].style.backgrou nd=col;
        }

        You keep add more tabels with more months to the page and the script will
        find them. See it in action at http://4umi.com/test2.htm where I have also
        made a beginning with moving some stuff out of the HTML into a stylesheet.
        HTH
        Ivo


        Comment

        • Jon

          #5
          Re: select fullrow

          Thanks

          It's works perfectly

          Jon


          "Ivo" <no@thank.you > skrev i meddelandet
          news:40bef187$0 $1757$abc4f4c3@ news.wanadoo.nl ...[color=blue]
          > "Jon" wrote[color=green]
          > > "Ivo" skrev[color=darkred]
          > > > "Jon" typed
          > > > > Looking for a way to select the fullrow when i click on LAG 3
          > > > > So it marks all of LAG 3 for July, August, September
          > > > > If I select LAG 4 it'll select of LAG 4 in the different months
          > > > >
          > > > > It would very nice if there is a way with Javascript
          > > > > Follow the link below
          > > > > http://www.johak.se/schema/index.html
          > > > >[/color][/color]
          > <snip script>[color=green]
          > >
          > > Yes it worked perfectly.
          > > But I need it too work on several rows at the sametime
          > >[/color]
          >
          > I see. The following function does that (it also sets the background on[/color]
          the[color=blue]
          > TR deirectly and not on its TD's separately as did the previous function[/color]
          for[color=blue]
          > no good reason):
          >
          > function hiliteTR(el) {
          > var col= (el.style.backg round=='gold') ? 'none' : 'gold';
          > var r=0; while(el=el.pre viousSibling) r++;
          > var t=document.getE lementsByTagNam e('table');
          > for(var i=t.length; i--; ) t[i].rows[r].style.backgrou nd=col;
          > }
          >
          > You keep add more tabels with more months to the page and the script will
          > find them. See it in action at http://4umi.com/test2.htm where I have also
          > made a beginning with moving some stuff out of the HTML into a stylesheet.
          > HTH
          > Ivo
          >
          >[/color]


          Comment

          Working...