+ Start a Discussion
Praveen Kumar 212Praveen Kumar 212 

Javascript instead of Controller methods

Hi All,
Here is my small code snippet. I have implemented the modal popup using CSS  and action:function. I want to do this toggle effect without using controller. So that i can implement everything in the VF page itself. Help! :)
<apex:page controller="dumm" >
 <apex:form id="form" >
   <apex:image id="theImage" onmouseover="showPopup()" onmouseout="hidePopup()"  value= "{!$Resource.EC2Console_RebootImage}" width="30" height="30"/>
    <apex:actionFunction action="{!showPopUp}" name="showPopup" reRender="form" />
    <apex:actionFunction action="{!closePopup}" name="hidePopup" reRender="theIframe" />
    <apex:outputPanel id="tstpopup">
        <apex:outputPanel styleClass="popupBackground"   layout="block" rendered="{!displayPopUp}"/>
            <apex:outputPanel styleClass="custPopup"  rendered="{!displayPopUp}">
               <apex:commandButton value="Close" action="{!closePopup}" rerender="tstpopup"/>
                <apex:iframe src="https://www.salesforce.com"  scrolling="true" height="300"></apex:iframe></apex:outputPanel>
<style type="text/css">
            background-color: white;
            border-width: 2px;
            border-style: solid;
            z-index: 9999;
            left: 50%;
            position: absolute;
            width: 700px;
            margin-left: -250px;
            opacity: 0.20;
            filter: alpha(opacity = 20);
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            z-index: 9998;


public with sharing class dumm {

    public dumm(ApexPages.StandardController controller) {


public boolean displayPopup {get; set;} 
    public dumm(){
        displayPopup = false;
    public void closePopup() {        
        displayPopup = false;    
    public void showPopup() {        
        displayPopup = true;    

Amit Chaudhary 8Amit Chaudhary 8
Please check below post. I hope that will help you
1) http://blogforce9.blogspot.in/2014/01/simple-popup-in-salesforce-standard-vf.html

How to create popup by clicking a custom button in a standard page layout in Salesforce
var iframe_url = '{!URLFOR("/apex/[your_visualforce_page]")}';
var j$modalDialog = j$('<div></div>')
       .html('<iframe id="iframeContentId" src="' + iframe_url + '" frameborder="0" height="100%" width="100%" marginheight="0" marginwidth="0" scrolling="no" />')
            autoOpen: false,
            title: 'My Modal Dialog',
            resizable: false,
            width: 400,
            height: 400,
            autoResize: true,
            modal: true,
            draggable: false

Please let us know if this will help you

You can use Jquery Modal box (colorbox)
Please refer to the link : http://salesforceguy.blogspot.in/2015/02/jquery-colorbox-modal-window-in.html