Home>

Sometimes you need to post data to another page,Then you need to build a form

<form name="postform" method="post">
<input name="msg" value="" />
</form>
document.write ("<form ..."
//document.write("&iframe src=\ "about:blank \" name=\ "hiddenframe \" id=\ "hiddenframe \" width=\ "0 \" height=\ "0 \" frameborder=\ "0 \"<</iframe>");

Submitting with the following js does not work,Because the form hit on the page is not an object,But a string

//theform.action="http://msg.baihe.com/tortoise/pages/tortoise/sm_gb2312.jsp?returnurl="+strreturnurl;
//document.getelementbyid ("pathid"). value="3070";
//document.getelementbyid ("title"). value="Hello!";
//document.getelementbyid ("content"). value="I set you as my focus.
Let's chat :) ";
//document.getelementbyid ("closewindow"). value="1";

So you need to create the form object dynamically by using the following methods:

var form_feedback=document.createelement ("form");
  document.body.appendchild (form_feedback);
  var i=document.createelement ("input");
  i.type="hidden";
  i.name="title";
  i.value="Hello!";
  form_feedback.appendchild (i);
  var j=document.createelement ("input");
  j.type="hidden";
  j.name="content";
  j.value="I set you as my focus.
Let's chat :) ";
  form_feedback.appendchild (j);
  var hiddeniframe=document.createelement ("iframe");
  hiddeniframe.src="about:blank";
  hiddeniframe.name="hiddenframe";
  hiddeniframe.id="hiddenframe";
  hiddeniframe.width="0";
  hiddeniframe.height="0";
  hiddeniframe.frameborder="0";
  form_feedback.appendchild (hiddeniframe);
  form_feedback.action="http://msg.baihe.com/tortoise/pages/tortoise/sm_gb2312.jsp?returnurl=";
  form_feedback.target="hiddenframe";
  form_feedback.method="post";
  form_feedback.submit ();
  • Previous JQuery ajax processing method when returning JSON (three ways)
  • Next Teach you to identify simple PHP-free backdoors