Wednesday, 11 July 2012

how to open a page using ifram and jqury popup

Code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
     <script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>
    <style type="text/css">
    #popupBoxClose
 {
    font-size:10px;
    line-height:15px;
    right:5px;
    top:5px;
    position:absolute;
    color:#6fa5e2;
    font-weight:500;    
}
#popup_box {
    display:none;
    position:fixed;
    _position:absolute;
    height:auto;
    width:auto;
    background:#FFFFFF;
    left: 300px;
    top: 150px;
    z-index:100;
    margin-left: 15px;
    border:2px solid #999999;    
    padding:15px;
    font-size:15px;
    -moz-box-shadow: 0 0 5px #ff0000;
    -webkit-box-shadow: 0 0 5px #ff0000;
 
}

    </style>
     <script type="text/javascript">
         function x(s) {
             $('#<%=im.ClientID %>').attr('src', s);
             $('#popup_box').slideDown("slow");
          }
         $(document).ready(function () {
           
             $('#popup_box').click
             (
             function () {
                 $('#popup_box').slideUp("slow");
             }
             )
             Sys.WebForms.PageRequestManager.getInstance().add_endRequest(JqueryAction);
             JqueryAction();
         });
         function ShowPopUp() {
         
             $('#popup_box').slideDown("slow");
         }
         function JqueryAction() {
           
             $('#popupBoxClose').click(function () {
                 $('#popup_box').slideUp("slow");
             });
         }
      
</script>
</head>
<body>
    <form id="form1" runat="server">
  
<a href="#"  onclick="x('Default.aspx')" id="ab" >Press Me</a>
<div id="popup_box">
<a id="popupBoxClose" href="#">Close</a><br />
     <iframe runat="server" id="im" style="height:300px; width:600px"></iframe>
</div>


   
    </form>
</body>
</html>

No comments:

Post a Comment