开发者

Submit form to new window's frame

I want a html-form to

  1. open a new window (which contains 2 frames)
  2. sen开发者_Python百科d the data of the form to one of these frames as a request

Is this possible? Currently, the form just opens a new window with and sends the request to the URL of the page that processes it. But what I want is that the new window that opens has two frames, one of which processes the form data.

I hope you understand my question and thank you for an answer.


Option A

you will need to use AJAX and make those steps:

  1. Open new window
  2. Send request by using AJAX
  3. Get response
  4. Put response to DIV in new window

Option B

you will need to create special html file that will be default page one of frame. next you will need to copy whole form with values of inputs to this file and trigger the submit. this way is without AJAX but it's more hmm.... twisted?

tell which option you prefere and then i can help you with code if you want of course

You can open and access new window by:

newWin = null;
newWin = open("page.html", 'win1')
if(newWin&&newWin.open&&!newWin.closed){
    newDiv=newWin.document.createElement("DIV")
    newWin.document.body.appendChild(newDiv)
    newWin.focus()
} else {
    alert("The window is not open")
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜