当我使用Jquery单击按钮时,我想创建一个弹出窗口

时间:2011-10-18 21:22:18

标签: jquery popup

当我点击下面带有代码的按钮时,应该会弹出。我需要创建一个弹出窗口,询问当您点击按钮时,您是新客户还是现有客户。我该怎么做呢。应该感谢帮助。

<a style="display: inline-block; width: 85px; font-weight: normal;" href="javascript:__doPostBack('mrpPhones$ctl06$lineItemPrice$lnkbtnAddToCart','')" class="button-genericsprite green-button-23cart" title="Add to cart" id="mrpPhones_ctl06_lineItemPrice_lnkbtnAddToCart" onclick="javascript:hideProgressBar();return openPlanChangeRequiredPopup('cd244ed6-7afc-4db5-bf764b7de21c9003','https://s.tmocache.com/images/png/products/phones/LG_Optimus_T_Black/110x110.png');">
    <span style="font-size: 12px;">Add to Cart</span>
</a>

2 个答案:

答案 0 :(得分:0)

如果我理解正确,我会使用jQuery UI中的模态对话框:

http://jqueryui.com/demos/dialog#modal

答案 1 :(得分:0)

我认为你需要这样的东西

<script>
$(function() {
  $( "#dialog-confirm" ).dialog({
        resizable: false,
        height:140,
        modal: true,
        buttons: {
            "New Customer": function() {
                                    //Put Necessary codes here
                $( this ).dialog( "close" );
            },
            "Existing customer": function() {
                                     //Put Necessary codes here
                $( this ).dialog( "close" );
            }
        }
    });
});
</script>

HTML:

<div id="dialog-confirm" title="New or Existing Customer?">
<p>
  <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px
   0;">New or Existing Customer?
  </span>
</p>
</div>