www.webdeveloper.com
Results 1 to 2 of 2

Thread: Filtering children object from parent

  1. #1
    Join Date
    Dec 2010
    Posts
    1

    Cool Filtering children object from parent

    Hi mates,

    As I'm newbie integrating PHP-HTML-JS I'd need some help for doing the following:

    I have a index.php including:

    <script type="text/javascript">
    function filter (phrase, _id){
    var words = phrase.value.toLowerCase().split(" ");
    var table = document.getElementById(_id);
    var ele;
    for (var r = 1; r < table.rows.length; r++){
    ele = table.rows[r].innerHTML.replace(/<[^>]+>/g,"");
    var displayStyle = 'none';
    for (var i = 0; i < words.length; i++) {
    if (ele.toLowerCase().indexOf(words[i])>=0)
    displayStyle = '';
    else {
    displayStyle = 'none';
    break;
    }
    }
    table.rows[r].style.display = displayStyle;
    }
    }
    </script>


    <div id="filter">
    <form>
    <input name="filt" onkeyup="filter(this, 'LIST', '1')" type="text">
    </form>

    <div id='iframe01'> <iframe src='child.php' name='iframe01'></iframe>
    </div>

    and a child.php including a table object with the id LIST.

    I'd need to change the parent.php in order to filter on real-time the table LIST via the FILT input on the parent form. I have tried different values instead of 'this' on the js function calling but nothing succesfully. żAny ideas?
    Thanks so much

  2. #2
    Join Date
    Dec 2004
    Location
    Kansas City, Missouri
    Posts
    31
    I don't know if you can access the DOM of a document displaying through an iframe window.
    This returns false on a document that I created with an iframe.
    Code:
    window.alert(document.getElementById('myiframeid').hasChildNodes());

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles