例如现在有一个工作汇报,要将上周总结跟本周计划放在一个表单一起管理,则可以用IFRAME实现

 

代码
//----------------方法1(只能用于1:n关系)-----------
//上周工作汇报
if(crmForm.FormType !='1' && crmForm.FormType !='5' && crmForm.FormType !='6')
{
         
var sArea = "new_new_departmentweekreport_new_departmentla";
         
if(location.href.toLowerCase().indexOf(ORG_UNIQUE_NAME.toLowerCase()+".")>0)
         {
    
var sBaseUrl = "http://"+document.location.host+"/userdefined/areas.aspx?";
         }
         
else
         {
    
var sBaseUrl = "/"+ORG_UNIQUE_NAME+"/userdefined/areas.aspx?";
         }
         
var html = sBaseUrl;
         html 
+= "oId=" + crmForm.ObjectId;
         html 
+= "&oType=" + crmForm.ObjectTypeCode;
         html 
+= "&security=" +crmFormSubmit.crmFormSubmitSecurity.value;
         html 
+= "&tabSet=" + sArea;
         crmForm.all.IFRAME_new_departmentlastweekreport.src 
= html;
}
else
{
         
if(crmForm.FormType =='1')
         {
                  crmForm.all.IFRAME_new_departmentlastweekreport.style.display 
= 'none';
         }
}


//本周工作安排
if(crmForm.FormType !='1' && crmForm.FormType !='5' && crmForm.FormType !='6')
{
         
var sArea = "new_new_departmentweekreport_new_departmentwe";
         
if(location.href.toLowerCase().indexOf(ORG_UNIQUE_NAME.toLowerCase()+".")>0)
         {
    
var sBaseUrl = "http://"+document.location.host+"/userdefined/areas.aspx?";
         }
         
else
         {
    
var sBaseUrl = "/"+ORG_UNIQUE_NAME+"/userdefined/areas.aspx?";
         }
         
var html = sBaseUrl;
         html 
+= "oId=" + crmForm.ObjectId;
         html 
+= "&oType=" + crmForm.ObjectTypeCode;
         html 
+= "&security=" +crmFormSubmit.crmFormSubmitSecurity.value;
         html 
+= "&tabSet=" + sArea;
         crmForm.all.IFRAME_new_departmentweekplanreport.src 
= html;
}
else
{
         
if(crmForm.FormType =='1')
         {
                  crmForm.all.IFRAME_new_departmentweekplanreport.style.display 
= 'none';
         }
}
//---------方法2(能用于1:n跟n:n关系)-------------
代码
/*seer lin modified from jim wang*/
var navId = "nav_new_new_myentity_account";
var objIFrame = crmForm.all.IFRAME_view;
loadMyArea(navId,objIFrame);

function loadMyArea(navId,objIFrame){
    
if(document.getElementById(navId) != null)
    {
      
var tmp = document.getElementById(navId).onclick.toString();
      tmp 
= tmp.substring(tmp.indexOf("'")+1, tmp.indexOf(";"));
      
var tabSet = tmp.substring(0, tmp.indexOf("'"));
      
var roleOrd =  (tmp.indexOf("roleOrd"== -1? -1 : tmp.substring( tmp.indexOf("roleOrd"), tmp.lastIndexOf("'")).replace("\\x3d""=");
      
var path="";
        
if (crmForm.ObjectId != null)
      {
        
var id = crmForm.ObjectId;
        
var type = crmForm.ObjectTypeCode;
        
var security = crmFormSubmit.crmFormSubmitSecurity.value;
        
var pathbase = document.location.pathname.substring(0, document.location.pathname.indexOf("edit.aspx")) + "areas.aspx?";
    
        path
=pathbase + "oId=" + id + "&oType=" + type + "&security=" + security + "&tabSet=" + tabSet;
      }
      
else
      {
        path
= "about:blank";
      }
      
if(roleOrd == -1){
              objIFrame.src
=path;
      }
else{
          objIFrame.src
=path+"&"+roleOrd;
      }
    }
}

 

 

posted on 2010-09-17 09:43  Seer Lin  阅读(516)  评论(0编辑  收藏  举报