fec.js 711 B

1234567891011121314151617181920
  1. $(document).ready(function(){
  2. $("img.lazy").each(function(){
  3. src = $(this).attr("data-src");
  4. $(this).attr("src",src);
  5. });
  6. });
  7. function doPost(to, p) { // to:提交动作(action),p:参数
  8. var myForm = document.createElement("form");
  9. myForm.method = "post";
  10. myForm.action = to;
  11. for (var i in p){
  12. var myInput = document.createElement("input");
  13. myInput.setAttribute("name", i); // 为input对象设置name
  14. myInput.setAttribute("value", p[i]); // 为input对象设置value
  15. myForm.appendChild(myInput);
  16. }
  17. document.body.appendChild(myForm);
  18. myForm.submit();
  19. document.body.removeChild(myForm); // 提交后移除创建的form
  20. }