php页面刷新

作者:网络 来源:佚名 更新时间:2008-05-07 16:36:32 点击:

refresh1.php新增后刷新显示:echo "<script language='javascript'>
              window.dialogarguments.parent.dialog_main.tb_addnew('".$task_insert_id."', '".$sc."',
                                                                  '".$mlist2['owner']."', '".$mlist2['start_date']."', '".$mlist2['end_date']."');
               window.close();
        </script>";
exit;

 refresh.ihtml

<script language="javascript1.2">
    //editor_generate('txt_content');
function numbercells(){  显示增加表格函数
    var count=0;
    for (i=0; i<document.all.table_add.rows.length; i++) ...{
        for (j=0; j<document.all.table_add.rows(i).cells.length; j++) ...{
            document.all.table_add.rows(i).cells(j).innertext=count;
            count++;
        }
    }
}

function tb_addnew(id1,t1,t2,t3) { 插入一条记录
    var ls_t=document.all("table_add");
    maxrow=ls_t.rows.length;
    maxcell=ls_t.rows(0).cells.length;
    mynewrow=ls_t.insertrow();
   
    for (i=0; i<maxcell; i++) {
        if (i==0) t0=id1; 必须显示列值id,才能实现即时刷新
        else if (i==1) t0=t1;
        else if (i==2) t0=t2;
        else if (i==3) t0=t3;
        else if (i==4) t0="&nbsp;
                       <input type='button' name='btn_edit21' value='#' onclick='javascript:tb_edit("+id1+");'>&nbsp;
                       <input type='button' name='btn_minus21' value='-' onclick='javascript:tb_delete("+id1+");'>";
        else if (i==5) t0="<input id='checkbox' name='checkbox[]' type='checkbox' value='idl' $checkbox_checked >";
        mynewcell=mynewrow.insertcell();
        //mynewcell.innertext=t0;   //在<td>  </td>之间不包含html的内容
        mynewcell.innerhtml=t0;   //包含html的内容
    }

   
}

function tb_edit(sid) ...{
    open_dialog('refresh1.php?action=edit&sid='+sid,'topic_edit','600','600');
}

function tb_view(sid) ...{
    open_dialog('refresh1.php?action=view&sid='+sid,'topic_edit','600','600');
}

function tbrow_edit(sid,t1,t2,t3,t4) ...{
    var ls_t=document.all("table_add");
    maxrow=ls_t.rows.length;
    for (i=0; i<maxrow; i++) ...{
        if (ls_t.rows(i).cells(0).innerhtml==sid) ...{
            ls_t.rows(i).cells(1).innerhtml=t1;
            ls_t.rows(i).cells(2).innerhtml=t2;
            ls_t.rows(i).cells(3).innerhtml=t3;   //只需显示到修改的列
            //ls_t.rows(i).cells(4).innerhtml=t4;
            break;
        }
    }
}

function tb_delete(sid) ...{
    if (confirm("确定要删除吗?")) ...{
        open_dialog('refresh1.php?action=delete&sid='+sid,'topic_delete','600','400');
        //var ls_t=document.all("table_add");
        //ls_t.deleterow();
    }
}

function tbrow_delete(sid) ...{   
    var ls_t=document.all("table_add");
    maxrow=ls_t.rows.length;
    for (i=0; i<maxrow; i++) ...{
        if (ls_t.rows(i).cells(0).innerhtml==sid) ...{
            //window.alert(i);
            ls_t.deleterow(i);
            break;
        }
    }   
}
</script>
<script language="javascript1.2">
    //editor_generate('problem_desc');
    //editor_generate('problem_reason');
    //editor_generate('settle_desc');
    //editor_generate('amend_desc');
    //editor_generate('assess_desc');
</script>

当需要两个刷新框架时,可写两次该代码,只是函数不用重名。