我有一个问题是使用asp.net在codebehind中打开jquery popup [英] I have a problem to open jquery popup in codebehind using asp.net

查看:49
本文介绍了我有一个问题是使用asp.net在codebehind中打开jquery popup的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我在使用asp.net打开代码隐藏中的jquery popup时遇到问题。



这是我的代码:



Hi,

I have a problem to open jquery popup in codebehind using asp.net.

This is my code:

<div id="popupSharev" class="popup_block2">
              <div id="Div2" class="active">
            <div id="share-link1" class="share-link">
            
            <p>
            <a id="hide" href="#" title="Close" class="c-link"></a>
            <h3>Hi this is popup window</h3>
            <asp:Button runat="server" ID="btnUpdate" />
            </p>
            </div>
            </div>
            </div>





这是打开弹出窗口的锚标签



this is anchor tag to open to popup

<a id="imgshare" href="#?w=500" class="poplight1" rel="popupSharev">
                                           <span><b>1.3K</b> SHARES</span>
                                       </a>





这是我的剧本:





This is my script:

<script type="text/javascript">


         //When you click on a link with class of poplight and the href starts with a #
         $('a.poplight1[href^=#]').click(function () {
             var popID = $(this).attr('rel'); //Get Popup Name
             var popURL = $(this).attr('href'); //Get Popup href to define size

             //                url.src = "ShareMail.aspx";
             //Pull Query & Variables from href URL
             var query = popURL.split('?');
             var dim = query[1].split('&');
             var popWidth = dim[0].split('=')[1]; //Gets the first query string value

             //Fade in the Popup and add close button
             $('#' + popID).fadeIn().css({ 'width': Number(popWidth) }).prepend('<a href="#" class="close btn_close1 c-link2"></a>');

             //Define margin for center alignment (vertical + horizontal) - we add 80 to the height/width to accomodate for the padding + border width defined in the css
             var popMargTop = ($('#' + popID).height() + 80) / 2;
             var popMargLeft = ($('#' + popID).width() + 80) / 2;

             //Apply Margin to Popup
             $('#' + popID).css({
                 'margin-top': -popMargTop,
                 'margin-left': -popMargLeft
             });

             //Fade in Background
             $('body').append('<div id="fade2" style="z-index:10"></div>'); //Add the fade layer to bottom of the body tag.
             $('#fade2').css({ 'filter': 'alpha(opacity=80)' }).fadeIn(); //Fade in the fade layer

             return false;
         });


              //When you click on a link with class of poplight and the href starts with a #
              $('a.poplight1[href^=#]').click(function () {
                  var popID = $(this).attr('rel'); //Get Popup Name
                  var popURL = $(this).attr('href'); //Get Popup href to define size

                  //                url.src = "ShareMail.aspx";
                  //Pull Query & Variables from href URL
                  var query = popURL.split('?');
                  var dim = query[1].split('&');
                  var popWidth = dim[0].split('=')[1]; //Gets the first query string value

                  //Fade in the Popup and add close button
                  $('#' + popID).fadeIn().css({ 'width': Number(popWidth) }).prepend('<a href="#" class="close btn_close1 c-link2"></a>');

                  //Define margin for center alignment (vertical + horizontal) - we add 80 to the height/width to accomodate for the padding + border width defined in the css
                  var popMargTop = ($('#' + popID).height() + 80) / 2;
                  var popMargLeft = ($('#' + popID).width() + 80) / 2;

                  //Apply Margin to Popup
                  $('#' + popID).css({
                      'margin-top': -popMargTop,
                      'margin-left': -popMargLeft
                  });

                  //Fade in Background
                  $('body').append('<div id="fade2" style="z-index:10"></div>'); //Add the fade layer to bottom of the body tag.
                  $('#fade2').css({ 'filter': 'alpha(opacity=80)' }).fadeIn(); //Fade in the fade layer

                  return false;
              });


              //Close Popups and Fade Layer
              $('a.close, #fade2').live('click', function () { //When clicking on the close or fade layer...
                  $('#fade2 , .popup_block2').fadeOut(function () {
                      $('#fade2, a.close').remove();
                  }); //fade them both out

                  return false;
              });
              function fdout() {
                  $('#fade2 , .popup_block2').fadeOut(function () {
                      $('#fade2, a.close').remove();
                  }); //fade them both out

                  return false;

              }



              function fdout() {
                  $('#fade2').remove();

              }

              function HideCtrl(ctrl, timer) {
                  var ctryArray = ctrl.split(",");
                  var num = 0, arrLength = ctryArray.length;
                  while (num < arrLength) {
                      if (document.getElementById(ctryArray[num])) {
                          setTimeout('document.getElementById("' + ctryArray[num] + '").style.display = "none";', timer);
                      }
                      num += 1;
                  }
                  return false;
              }
           </script>



如果我将使用linkbutton并在onclick事件中我想打开弹出窗口。



请帮助我......

谢谢。


If I will take linkbutton and with in onclick event I want to open popup.

Please Help me......
Thank you.

推荐答案

' a.poplight1 [href ^ =#]') .click( function (){
var popID =
('a.poplight1[href^=#]').click(function () { var popID =


this )。attr(' rel' ); // 获取弹出名称
var popURL =
(this).attr('rel'); //Get Popup Name var popURL =


this )。attr(' href'); // 获取Popup href以定义大小

// url.src =ShareMail.aspx;
// 拉查询&来自href URL的变量
var query = popURL.split(' ');
var dim = query [ 1 ] .split(' &');
var popWidth = dim [ 0 ] .split(' =')[ 1 ]; // 获取第一个查询字符串值

// 淡入弹出窗口并添加关闭按钮
(this).attr('href'); //Get Popup href to define size // url.src = "ShareMail.aspx"; //Pull Query & Variables from href URL var query = popURL.split('?'); var dim = query[1].split('&'); var popWidth = dim[0].split('=')[1]; //Gets the first query string value //Fade in the Popup and add close button


这篇关于我有一个问题是使用asp.net在codebehind中打开jquery popup的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆