您的位置:首页 > 其它

salesforce apex + vf page 弹窗口

2013-08-03 18:00 323 查看
1. apex controller:

public class YUT_popup {

public boolean displayPopup {get; set;}

public void closePopup() {
displayPopup = false;
}

public void showPopup() {
displayPopup = true;
}
}


2. VF page:

<apex:page controller="YUT_popup">
<apex:form >
<apex:commandButton value="Show Pop up" action="{!showPopup}" rerender="popup"/>
<apex:pageBlock >
Lorem ipsum ..... dummy stuff to show the popup is above content
</apex:pageBlock>

<apex:outputPanel id="popup">
<apex:outputPanel styleClass="customPopup" layout="block" rendered="{!displayPopUp}">
Lorem ipsum <br/><br/><br/>
<apex:commandButton value="Hide Pop up" action="{!closePopup}" />
</apex:outputPanel>
</apex:outputPanel>

</apex:form>

<style type="text/css">
.customPopup{
background-color: white;
border-style: solid;
border-width: 2px;
left: 50%;
padding:10px;
position: absolute;
z-index: 9999;
/* These are the 3 css properties you will need to tweak so the pop
up displays in the center of the screen. First set the width. Then set
margin-left to negative half of what the width is. You can also add
the height property for a fixed size pop up.*/
width: 500px;
margin-left: -250px;
top:100px;
}
</style>
</apex:page>


3.实现效果:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: