Logo
You
Code

Add form on fly

  • Javascript
Autor YouCode - http://www.youcode.com.ar/javascript/add-form-on-fly-509

Javascript, how to add form on fly

var form = document.createElement("form");
form.setAttribute("method", "post");
form.setAttribute("action", "page.php");

var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", "name_data");
hiddenField.setAttribute("value","12345");

form.appendChild(hiddenField);

document.body.appendChild(form);
form.submit();
http://www.youcode.com.ar/javascript/add-form-on-fly-509