SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    doRighteousDeeds++
    Join Date
    Aug 2006
    Location
    تركيا Turkey Türkiye
    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 16:38.
    The Time Through Ages. In the Name of Allah, Most Gracious, Most Merciful.
    1. By the Time, 2. Verily Man is in loss,
    3. Except such as have Faith, and do righteous deeds, and (join together) in the mutual enjoining of Truth, and of Patience and Constancy.

  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
    doRighteousDeeds++
    Join Date
    Aug 2006
    Location
    تركيا Turkey Türkiye
    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 13:56.
    The Time Through Ages. In the Name of Allah, Most Gracious, Most Merciful.
    1. By the Time, 2. Verily Man is in loss,
    3. Except such as have Faith, and do righteous deeds, and (join together) in the mutual enjoining of Truth, and of Patience and Constancy.

  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
    doRighteousDeeds++
    Join Date
    Aug 2006
    Location
    تركيا Turkey Türkiye
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Jimfraser,
    What is AOK?
    The Time Through Ages. In the Name of Allah, Most Gracious, Most Merciful.
    1. By the Time, 2. Verily Man is in loss,
    3. Except such as have Faith, and do righteous deeds, and (join together) in the mutual enjoining of Truth, and of Patience and Constancy.

  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
    doRighteousDeeds++
    Join Date
    Aug 2006
    Location
    تركيا Turkey Türkiye
    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 15:13.
    The Time Through Ages. In the Name of Allah, Most Gracious, Most Merciful.
    1. By the Time, 2. Verily Man is in loss,
    3. Except such as have Faith, and do righteous deeds, and (join together) in the mutual enjoining of Truth, and of Patience and Constancy.


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
  •