JavaScript表单/这里出了什么问题?
我有两个html页面,A和B。A打开B作为弹出窗口。B应该在A中打开其内容,但它没有。B有target=''u parent',它应该是开始帧。怎么了?如何做到这一点?您可以通过将下面的代码片段保存在两个文件a.html和b.html中来测试这一点 提交表单A应打开弹出窗口B,提交B应加载在A中,而不是关闭JavaScript表单/这里出了什么问题?,javascript,html,forms,popupwindow,Javascript,Html,Forms,Popupwindow,我有两个html页面,A和B。A打开B作为弹出窗口。B应该在A中打开其内容,但它没有。B有target=''u parent',它应该是开始帧。怎么了?如何做到这一点?您可以通过将下面的代码片段保存在两个文件a.html和b.html中来测试这一点 提交表单A应打开弹出窗口B,提交B应加载在A中,而不是关闭 <html> <body> <form method="post" onSubmit="window.open( 'b.html', '_blank',
<html>
<body>
<form method="post" onSubmit="window.open( 'b.html', '_blank', 'width=400,height=400,resizeable,scrollbars');">
<h1>Page A</h1>
<label>
<span>Your Name :</span>
<input id="name" type="text" name="name" placeholder="Your Full Name" />
</label>
<label>
<span> </span>
<input type="submit" class="button" value="Send" />
</label>
</form>
A页
你的名字:
和b.html
<html>
<body>
<form method="post" onSubmit="window.open('b.html','_parent','');" >
<h1> Page B</h1>
<label>
<span>Your Email :</span>
<input id="email" type="email" name="email"/>
</label>
<label>
<span> </span>
<input type="submit" class="button" value="Send" />
</label>
</form>
B页
您的电子邮件:
我想你可以直接使用b.html表单标签的填充名
谢谢您的页面
b.html
需要一些Javascript代码才能将元素email
的值复制回原始页面。您会发现它提供了操作A页中DOM所需的参考。提交表单B应在初始帧A中打开。这是要求:A打开弹出窗口B,弹出窗口B提交回A。使用窗口。打开('A.html')将再次在B中打开。\u parent
是父帧,而不是父窗口。