2011-08-02 50 views

回答

1

你可以用简单的javascript和css来做到这一点。您需要做的是查看Portlet B和C portlet ID是否与使用javascript相同,您可以改变portlet边界div上的css“display”属性。

使用简单的JavaScript

var p = document.getElementById("p_p_id_YOUR-PORTLET-ID_"); 
if (p) { 
    if (p.style.display == "none") { 
    p.style.display = "block"; 
    } else { 
    p.style.display = "none"; 
    } 
} 

使用jQuery

jQuery("p_p_id_YOUR-PORTLET-ID_").show(); 
//or 
jQuery("p_p_id_YOUR-PORTLET-ID_").hide(); 

实例是用于显示/隐藏单个的portlet。在你的案例中,链接B应该隐藏C并且显示B,并且以其他方式链接C.

而且看看Client-side Inter-Portlet Communication

2

我用这个代码隐藏的portlet,但刷新页面portlet的再次看到后,你可以建议我可以刷新Portlet应该不可见后也这样做呢?

 function fun(E) 
     { 

      if(E=="Entry") 
       { 
      alert("hi"); 

       document.getElementById("p_p_id_ipc_WAR_IPC2portlet_").style.display='none'; 
       document.getElementById("p_p_id_ipc1_WAR_IPC2portlet_").style.display = ''; 



       } 

      else 
       { 
       alert("else"); 
       } 

      } 

    </script> 
相关问题