View Full Version : Filtering children object from parent

12-28-2010, 11:30 AM
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';
table.rows[r].style.display = displayStyle;

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

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

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 :)

12-28-2010, 12:06 PM
two things, you don’t have a parent form (the only child in the form is the text field). second, you want to access an iframe which is a completely new document. (and because I don’t use frames, I have forgotten how to access them through JavaScript). the this has to stay there, as it grants you access to the text field’s value.

12-28-2010, 07:28 PM
Thanxs, hope to read more ideas ;)