2016-12-19 7 views
0

이것은 내가 지금 가지고있는 코드이며, 버튼을 누르는 대신 페이지가로드 되 자마자 que 스크립트 (하단)를 실행하고 싶습니다. 내가 말했듯이Execute 이벤트 onload PHP 파일

{capture name=path} 
 
    {l s='Amanpay payment.' mod='amanpay'} 
 
{/capture} 
 

 
<h1 class="page-heading"> 
 
    {l s='Order summary' mod='amanpay'} 
 
</h1> 
 

 
{assign var='current_step' value='payment'} 
 
{include file="$tpl_dir./order-steps.tpl"} 
 

 
{if $nbProducts <= 0} 
 
\t <p class="alert alert-warning"> 
 
     {l s='Your shopping cart is empty.' mod='amanpay'} 
 
    </p> 
 
{else} 
 
     <div class="box cheque-box"> 
 
      <h3 class="page-subheading"> 
 
       {l s='Amanpay payment.' mod='amanpay'} 
 
      </h3> 
 
      <p class="cheque-indent"> 
 
       <strong class="dark"> 
 
        {l s='You have chosen to pay by Amanpay.' mod='amanpay'} 
 
        {l s='Here is a short summary of your order:' mod='amanpay'} 
 
       </strong> 
 
      </p> 
 
      <p> 
 
       - {l s='The total amount of your order is' mod='amanpay'} 
 
       <span id="amount" class="price">{displayPrice price=$total}</span> 
 
       {if $use_taxes == 1} 
 
        {l s='(tax incl.)' mod='amanpay'} 
 
       {/if} 
 
      </p> 
 
      <p> 
 
       - {l s='Please confirm your order by clicking "I confirm my order."' mod='amanpay'}. 
 
      </p> 
 
     </div> 
 

 
     <p class="cart_navigation clearfix" id="cart_navigation"> 
 
      {* 
 
     \t <a 
 
      class="button-exclusive btn btn-default" 
 
      href="{$link->getPageLink('order', true, NULL, "step=3")|escape:'html':'UTF-8'}"> 
 
       <i class="icon-chevron-left"></i>{l s='Other payment methods' mod='amanpay'} 
 
      </a> 
 
      *} 
 
      <a class="button btn btn-default button-medium" href="#" onclick="return confirm(event)"> 
 
       <span>{l s='I confirm my order' mod='amanpay'} 
 
       \t <i class="icon-chevron-right right"></i> 
 
       </span> 
 
      </a> 
 
      {*<div style="float: right;margin-top: -38px;">*} 
 
       {$amanpay_widget} 
 
      {*</div>*} 
 
     </p> 
 
     
 
     <script type="text/javascript"> 
 
     \t function confirm (e) 
 
     \t { 
 
     \t \t e.preventDefault(); 
 
       AmnPy.loadModal(); 
 
     \t } 
 
     </script> 
 
{/if}

, 내가 대신 확인 버튼

+1

window.onload를 사용해 보셨습니까? – Jorn

답변

1

완벽한을 클릭 할 필요없이 온로드 스크립트를 실행하는 데 페이지를 필요로한다! 마침내 ... 대답은 다음과 같습니다.

 <script> 
     $(document).ready(function() { 
      AmnPy.loadModal(); 
     }); 
     </script> 
+1

직접 해결하면 항상 만족할 수 있습니다. – Jorn