hxp
2024-11-19 3c433d5045813bd41d407b34a381cf100465621f
js/common.js
@@ -122,6 +122,21 @@
   }
}
function doSubmit(to, p, method='GET') { // to:提交动作(action),p:参数
   var myForm = document.createElement("form");
   myForm.method = method;
   myForm.action = to;
   for (var i in p) {
      var myInput = document.createElement("input");
      myInput.setAttribute("name", i); // 为input对象设置name
      myInput.setAttribute("value", p[i]); // 为input对象设置value
      myForm.appendChild(myInput);
   }
   document.body.appendChild(myForm);
   myForm.submit();
   document.body.removeChild(myForm); // 提交后移除创建的form
}
function random(min, max) {
   return Math.round(Math.random() * (max - min)) + min;
}