在frame中打开网页
function open_job()
{
window.top.document.getElementById("maincontent").cols = "60%,2%,*";
window.open("warning.php?content="+"please select one record",'operation');
window.open("job_mgt/job_mgt.php",'mainframe');
}
function open_doc()
{
window.top.document.getElementById("maincontent").cols = "100%";
window.open("page/doc_mgt/doc_management.php", "mainframe");
}
这两个函数,如果先调用第一个就没问题,如果先调用第二个再调用第一个,那么第一个中的 window.open("warning.php?content="+"please select one record",'operation');这句执行的时候就不会再operation中打开页面,而是全屏打开的
到底是什么原因呢?

解决方案 »

  1.   

    我没看到你的HTML所以没办法肯定,你确认下你的page/doc_mgt/doc_management.php是否含有maincontent, 第二个方法执行完后focus是在page/doc_mgt/doc_management.php上,而并不是在你执行open_doc() 这个页面上
      

  2.   

    两次window.top实际的对象不一样.
      

  3.   

    window.top.document.getElementById("maincontent").cols = "100%"; 
    我把这句去掉后就一切正常了,为什么呢?
      

  4.   

    还有一个现象
    function open_job() 

    window.top.document.getElementById("maincontent").cols = "60%,2%,*"; 
    window.open("warning.php?content="+"please select one record",'operation'); 
    window.open("job_mgt/job_mgt.php",'mainframe'); 

    如果改成
    function open_job() 

    window.top.document.getElementById("maincontent").cols = "60%,2%,*"; 
    window.open("job_mgt/job_mgt.php",'mainframe'); 
    window.open("warning.php?content="+"please select one record",'operation'); 


    就有的时候是正确的,有的时候warning.php这个页面就会全屏显示
      

  5.   

    解决了
    window.top.document.getElementById("maincontent").cols = "100%"; 
    这句不应该这么写,应该写成"*,0,0"