線上書籍

Home

JQUERY

  1. 按鈕
    templates/ugm_stk_purchase.tpl <!--廠商編號--> <div class='col-sm-3'> <div class='form-group'> <label for='vendor' class='control-label'>廠商編號</label> <div class="input-group"> <input type="text" class="form-control" id="vendor" name='vendor' value="<{$row.vendor}>" readonly> <div class="input-group-prepend"> <a href="javascript:void(0)" class="vendorWin" > <div class="input-group-text">...</div> </a> </div> </div> </div> </div>

     

  2. 調用插件 //廠商視窗 $(".vendorWin").click(function(){ var sn = $('#vendor').val();//取得廠商流水號 var url = 'purchase.php?op=vendorWin&sn='+sn; var wH = 350; var wW = 600; var position = $(this).offset(); var wL = position.left - wW - 300; var wT = position.top; // childWin(url,wH,wW,wL,wT); });

     

  3. 子視窗函數 //子視窗函數 function childWin(url,wH,wW,wL,wT) { mywin=window.open("","","height=" + wH + ",width=" + wW + ",left="+ wL + ",top=" + wT ); mywin.location.href = url ; }

     

  4. 程式流程 #----- 廠商視窗 case "vendorWin": echo vendorWin($sn); exit;

     

  5. 程式函數
  6. 傳回商品sn,由母視窗AJAX
  7. 程式
    流程
    函數
  8.