adding line-through style to a table row

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

    adding line-through style to a table row

    I want that if user clicks in a checkbox, the strike-through effect applices
    to current table row. I tried the following code in IE, but nothing happens.

    Any idea ?

    <table>
    <tr><td><inpu t type=checkbox onclick="cboncl ick(this)"></td>
    <td><input type=text value="Row 1" ></td>
    <td><select><op tion>pine</option><option> orange</option></select></td></tr>

    <tr><td><inpu t type=checkbox onclick="cboncl ick(this)"></td>
    <td><input type=text value="Row 2"></td>
    <td><select><op tion>apple</option><option> kiwi</option></select></td></tr>
    </table>

    <script>
    function cbonclick(othis ) {
    othis.parentNod e.parentNode.st yle.textDecorat ion=
    othis.checked? 'line-through':'';
    }
    </script>



  • Lasse Reichstein Nielsen

    #2
    Re: adding line-through style to a table row

    "Andrus" <nospam_eetasof t_no@online.ee> writes:
    [color=blue]
    > I want that if user clicks in a checkbox, the strike-through effect applices
    > to current table row. I tried the following code in IE, but nothing happens.[/color]

    You can't make strike-through (or any other text decoration) affect
    input or select elements.

    <input type="text" value="test" style="text-decoration:stri ke-through">
    gives normal text in the textbox.

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • DU

      #3
      Re: adding line-through style to a table row

      Lasse Reichstein Nielsen wrote:
      [color=blue]
      > "Andrus" <nospam_eetasof t_no@online.ee> writes:
      >
      >[color=green]
      >>I want that if user clicks in a checkbox, the strike-through effect applices
      >>to current table row. I tried the following code in IE, but nothing happens.[/color]
      >
      >
      > You can't make strike-through (or any other text decoration) affect
      > input or select elements.[/color]

      line-through works in select (at least options in select) in NS 7.x,
      Mozilla-based browsers. One could also simply change the color from
      black to silver for input type="text" and options and then make the
      input and select disabled=true.
      [color=blue]
      >
      > <input type="text" value="test" style="text-decoration:stri ke-through">
      > gives normal text in the textbox.
      >
      > /L[/color]

      CSS2 is line-through, not strike-through.

      DU
      --
      Javascript and Browser bugs:


      Comment

      • Lasse Reichstein Nielsen

        #4
        Re: adding line-through style to a table row

        DU <drunclear@hotR EMOVEmail.com> writes:
        [color=blue]
        > line-through works in select (at least options in select) in NS 7.x,
        > Mozilla-based browsers.[/color]

        It appears it works in IE6 too. I was checking in Opera 7, where it
        doesn't.
        Ofcourse, saying anything about input elements in general is dangerous,
        since there is no standard that defines how they look.
        [color=blue]
        > CSS2 is line-through, not strike-through.[/color]

        Doh. That's what I meant, ofcourse.
        /L
        --
        Lasse Reichstein Nielsen - lrn@hotpop.com
        Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
        'Faith without judgement merely degrades the spirit divine.'

        Comment

        • Andrus Moor

          #5
          Re: adding line-through style to a table row


          "Lasse Reichstein Nielsen" <lrn@hotpop.com > wrote in message
          news:7k6cdhx2.f sf@hotpop.com.. .[color=blue]
          > DU <drunclear@hotR EMOVEmail.com> writes:
          >[color=green]
          > > line-through works in select (at least options in select) in NS 7.x,
          > > Mozilla-based browsers.[/color]
          >
          > It appears it works in IE6 too. I was checking in Opera 7, where it
          > doesn't.
          > Ofcourse, saying anything about input elements in general is dangerous,
          > since there is no standard that defines how they look.
          >[color=green]
          > > CSS2 is line-through, not strike-through.[/color][/color]

          The code below following code shows line-through effect in IE 6

          I have a table whose rows contain

          <input type=text>, <input type=checkbox>, <span> <select> and <textarea>
          elements cells.

          Which is the best way to change cbonclick() so that it applies this effect
          to all elements in table row ?



          <table>
          <tr><td><inpu t type=checkbox onclick="cboncl ick(this)"></td>
          <td><input type=text value="Row 1" ></td>
          <td><select><op tion>pine</option><option> orange</option></select></td></tr>

          <tr><td><inpu t type=checkbox onclick="cboncl ick(this)"></td>
          <td><input type=text value="Row 2" style="text-decoration:line-through"[color=blue]
          ></td>[/color]
          <td><select style="text-decoration:line-through"><optio n>apple</option>
          <option>kiwi</option></select></td></tr>
          </table>

          <script>
          function cbonclick(othis ) {
          othis.parentNod e.parentNode.st yle.textDecorat ion=
          'line-through';
          }
          </script>


          Comment

          • Lasse Reichstein Nielsen

            #6
            Re: adding line-through style to a table row

            y-e.perio@em-lyon.com (Yep) writes:
            [color=blue]
            > Well it seems to work as of my Opera7b version, or are my glasses
            > striken-through ;-) See code below (a bit strange I'll admit, but IMHO
            > quite adapted to the problematic, especially in regards of the CSS
            > complex issues involved).[/color]

            When I test it in O7.20b1, only the text Hello is line-through'ed, not
            the input or select elements.
            [color=blue]
            > /*@cc_on[/color]

            What does this fancy comment do? It is something in JScript.NET, right?
            Shouldn't it be /*@cc_on */ ?
            Uncommenting the next line made no difference in Opera 7.20b1.
            [color=blue]
            > elems={td:true, input:true, select:true};[/color]

            /L
            --
            Lasse Reichstein Nielsen - lrn@hotpop.com
            Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
            'Faith without judgement merely degrades the spirit divine.'

            Comment

            • Yep

              #7
              Re: adding line-through style to a table row

              Lasse Reichstein Nielsen <lrn@hotpop.com > wrote in message news:<7k6by7hn. fsf@hotpop.com> ...[color=blue]
              > y-e.perio@em-lyon.com (Yep) writes:
              > When I test it in O7.20b1, only the text Hello is line-through'ed, not
              > the input or select elements.[/color]

              Interesting. The version I've been testing on is
              Version 7.0
              Build 2349
              Platform Win32
              System Windows 98
              and it strikes the INPUT and SELECT elements correctly. If you add
              inline style to the form controls, it even strikes twice :-)
              [color=blue][color=green]
              > > /*@cc_on[/color]
              > What does this fancy comment do? It is something in JScript.NET, right?[/color]

              Well I don't know for JScript.Net; in (good old) JScript that's
              conditional compilation; the point actually is that browser detection
              was
              (IMHO) required here, given the CSS complex rules and UAs different
              behaviors I'd come across (your findings with latest O7 may change the
              approach, though).


              Regards,
              Yep.

              Comment

              Working...