SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Addict
    Join Date
    Aug 2006
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    var tr = it.parentNode.parentNode;

    This code is not working on Firefox. How can I do? Thanks...
    Code:
    <script type="text/javascript">
    function check(it) {
    var tr = it.parentNode.parentNode;
      tr.style.backgroundColor = (it.checked) ? "gold" : "white";
    }
    </script>
    <form onsubmit="return false">
    <table border=1 width=100%>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    </table>
    </form>
    Last edited by muazzez; Mar 2, 2007 at 15:38.
    Bismillahirrahmanirrahîm
    Bizi doğru yola, kendilerine nimet verdiklerinin yoluna ilet; gazaba uğrayanların ve sapıklarınkine değil.

  2. #2
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That code works fine for me in Firefox 1.5

  3. #3
    SitePoint Addict
    Join Date
    Aug 2006
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Pepejeria,
    Now I use Firefox 2.0.0.1
    This code is not working. Rows color did not change.
    I added message box. But it don't display message box on Firefox 2.0.0.1
    Code:
     
    <script type="text/javascript">
    function kontrol(it) {
    
    alert(it.parentNode.nodeName) ;
    alert(it.parentNode.parentNode.nodeName) ;
    
    var tr = it.parentNode.parentNode;
      tr.style.backgroundColor = (it.checked) ? "gold" : "white";
    }
    </script>
    <form>
    <table border=1 width=100%>
    <tr><td><input type="checkbox" onclick="kontrol(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="kontrol(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="kontrol(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    
    <tr><td><input type="checkbox" onclick="kontrol(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="kontrol(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="kontrol(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="kontrol(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    
    <tr><td><input type="checkbox" onclick="kontrol(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="kontrol(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="kontrol(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="kontrol(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    
    </table>
    </form>
    Last edited by muazzez; Mar 2, 2007 at 12:56.
    Bismillahirrahmanirrahîm
    Bizi doğru yola, kendilerine nimet verdiklerinin yoluna ilet; gazaba uğrayanların ve sapıklarınkine değil.

  4. #4
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tested in Firefox 2.0.0.2 working AOK. Complete html:
    Code:
    <html>
    <head>
    <script type="text/javascript">
    function check(it) {
    var tr = it.parentNode.parentNode;
      tr.style.backgroundColor = (it.checked) ? "gold" : "white";
    }
    </script>
    </head>
    <body>
    <form onsubmit="return false">
    <table border=1 width=100&#37;>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    <tr><td><input type="checkbox" onclick="check(this)"></td><td>testing!</td><td>testing!</td><td>testing!</td><td>testing!</td></tr>
    </table>
    </form>
    </body>
    </html>

  5. #5
    SitePoint Addict
    Join Date
    Aug 2006
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Jimfraser,
    What is AOK?
    Bismillahirrahmanirrahîm
    Bizi doğru yola, kendilerine nimet verdiklerinin yoluna ilet; gazaba uğrayanların ve sapıklarınkine değil.

  6. #6
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it's working just fine

    http://209.161.33.50/dictionary/AOK

  7. #7
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Same here with Firefox 2. Are you really using the code that you posted here? The only thing that could be causing a problem is a whitespace between those tags...

  8. #8
    SitePoint Addict
    Join Date
    Aug 2006
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Pepejeria,
    I use the code I posted here.
    Now, I use Firefox 2.0.0.2. The code is working. Thanks...
    Last edited by muazzez; Mar 3, 2007 at 14:13.
    Bismillahirrahmanirrahîm
    Bizi doğru yola, kendilerine nimet verdiklerinin yoluna ilet; gazaba uğrayanların ve sapıklarınkine değil.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •