English 中文(简体)
如何同时利用JQuery来调整和打开新的窗口?
原标题:How can i use JQuery to redirect and open a new window at the same time?

我工作一页,用户有两顿。 有一个纽顿只是将其转移到一个主页上,另一个纽芬兰不仅将其转移到主页上,而且还打开了一个新的窗口/表格,与另一个链接。

     <button class="return" type="button">
        <?= $html->image( cross.gif ) ?> Return
      </button>
      <button class="walletcards" type="button">
        <?= $html->image( cross.gif ) ?> Print Wallet Cards
      </button>

    <script type="text/javascript">
      $(document).ready( function() {
         $( button.return ).click( function() {
         $(window.location).attr( href , /accounts/view/<?=$data[ Email ]  [ acctgrpid ];   ?> );
});

$( button.walletcards ).click(function(){
 $(location).attr( href ,  /accounts/view/<?=$data[ Email ][ acctgrpid ]; ?> )
 });

 $( button.walletcards ).click(function(){
  window.close();
  window.open( /wallet_cards/account/<?=$data[ Email ][ acctgrpid ]; ?> );
  });

现在我发放了这一作品,但打开了两个链接窗口/标语(“/ Wallet_cards/account....”)。 如何阻止它打开两个窗口/表格,或者有更好的办法这样做。

问题回答

你的法典与你所描述的内容相比,没有什么混淆。 看来,你的守则是向纽特州增加2个点击事件,一个是向账户转拨,另一个是关闭窗口,打开一个新的窗口,以挂卡/账户。

您的窗口.close()也出现在您的窗口上。 我将扭转这些趋势,防止出现问题。

因此,我要向以下人士通报最新情况:

$( button.walletcards ).click(function() {
    window.open( /wallet_cards/account/<?=$data[ Email ][ acctgrpid ]; ?> );
    window.location.href =  /wallet_cards/account/<?=$data[ Email ][ acctgrpid ]; ?> ;
    //window.close();  // Not sure why you are redirecting but then closing the window...
});

为什么你试图把这2项行动放在同一个职能中?

$( button.walletcards ).click(function(){
  window.close();
  window.open( /wallet_cards/account/<?=$data[ Email ][ acctgrpid ]; ?> );

 $(location).attr( href ,  /accounts/view/<?=$data[ Email ][ acctgrpid ]; ?> )
 });




相关问题
Running jQuery command from modal window to affect main page

I m currently trying to write a jQuery script which opens a modal box then (upon user entry) changes a value on the original page. Currently I ve got the script working on just the page itself (...

Animate Window Resize (Width and Height) C# WPF

I m looking for some help on animating window resize of an open window! Cant seem to figure this one out! I m just using atm. this.Width = 500; Any help would be great! Thanks.

Cant drag and move a WPF Form

I design a WPF form with Window Style=None. So I Cannot see the drag bar in the form. How can I move the Form with WindowStyle=None Property?

Win32 CreateWindow() call hangs in child thread?

I m working on a portability layer for OpenGL (abstracts the glX and wgl stuff for Linux and Windows)... Anyhow, it has a method for creating a Window... If you don t pass in a parent, you get a real ...

WPF-XAML window in Winforms Application

I have a Winforms application coded in VS C# 2008 and want to insert a WPF window into the window pane of Winforms application. Could you explain me how this is done.

热门标签