日期:2014-05-16  浏览次数:20321 次

通过 js timer 控制 form 多次提交
Form.Element.AfterActivity = function(element, callback, delay) {
  element = $(element);
  if (!delay) delay = 0.25;
  new Form.Element.Observer(element, delay, function(element, value) {
    if (element.activity_timer) clearTimeout(element.activity_timer);
    element.activity_timer = setTimeout(function() { callback(element); }, delay * 1000 + 50);
  });
};

<script type="text/javascript">
//<![CDATA[
 Form.Element.AfterActivity('btn_submit', function(element) { $(element).up('form').submit(); }, 0.35);
//]]>
</script>