2010-03-01 69 views
1

我在Asp.Net vs08 C#上工作。我想显示按钮的弹出**底部**。不在页面中心。这里是我的语法。如何设置弹出位置?

.aspx的代码:

<input id="Button3" type="button" value="Open 1" /> 

的Jquery:

<script type="text/javascript"> 
    $(function() { 
     $("#Popup").dialog({ 
      bgiframe: true, 
      autoOpen: false, 
      height: 300, 
      modal: true, 
      buttons: { 
       Cancel: function() { 
        $(this).dialog("close"); 
       } 
      }, 
     close: function() { 
       allFields.val("").removeClass("ui-state-error"); 
     } 
     }).parent().appendTo($("form:first")); 
     $("#Button3").click() { 
     $("#Popup").dialog("open"); 
     }); 
    }); 
</script> 

告诉我的语法或修改我的语法。谢谢。

回答

1

你需要一个position字段添加到您选择的说法:

<script type="text/javascript"> 
    $(function() { 
     $("#Popup").dialog({ 
      bgiframe: true, 
      autoOpen: false, 
      height: 300, 
      modal: true, 
      position: [100, 200], // 100 is x location, 200 is y location, in pixels 
      buttons: { 
       Cancel: function() { 
        $(this).dialog("close"); 
       } 
      }, 
     close: function() { 
       allFields.val("").removeClass("ui-state-error"); 
     } 
     }).parent().appendTo($("form:first")); 
     $("#Button3").click() { 
     $("#Popup").dialog("open"); 
     }); 
    }); 
</script> 

position也能接受像"top""left"的字符串。

有关详细信息,请参阅jQuery UI Dialog documentation

+0

感谢。但我想设置位置动态。如何设置左侧的按钮控制的弹出窗口的位置,你的给定的语法位置:[100,200],没有解决我的问题。 – user280048 2010-03-01 07:18:31

+0

@ user280048而不是设置'[100,200]',只是传递一些你计算的位置... – 2010-03-01 12:57:33

0

就在位置关键字添加到您的查询像

位置:[400,500]

+1

谢谢。但我想动态地设置位置。如何设置按钮控件的左侧弹出位置,你给定的语法位置:[100,200],没有解决我的问题。 – user280048 2010-03-01 07:18:54