0

我使用了以下代码:

Form1.html

<html>

<head>
<title>Table of Data</title>
</head>

<body>

<form method="POST">

<table border="1" id="tblQuery">
<tr>
   <th>Query</th>
   <th>Answer</th>
   <th>Data Type</th>
   <th>Screen No.</th>
</tr>

<tr>
   <td>Name</td>
   <td><input type="text"/></td>
   <td>Textbox</td>
   <td>1</td>
   <td><input type="button" value="Edit" /><input type="button" value="Delete" /></td>
</tr>

<tr>
   <td>Gender</td>
   <td><input type="radio" name="gender" value="male" />Male<br><input type="radio" name="gender" value="female" />Female</td>
   <td>Radio Buttons</td>
   <td>2</td>
   <td><input type="button" value="Edit" /><input type="button" value="Delete" /></td>
</tr>

<tr>
   <td>Qualification</td>
   <td><input type="checkbox" name="qualification" value="graduate" />Graduate<br><input type="checkbox" name="qualification" value="post graduate" />Post Graduate</td>
   <td>Checkbox</td>
   <td>1</td>
   <td><input type="button" value="Edit" /><input type="button" value="Delete" /></td>
</tr>

<tr>
   <td>City</td>
   <td><select>
      <option value="new_delhi">New Delhi</option>
      <option value="mumbai">Mumbai</option>
      <option value="kolkata">Kolkata</option>
      <option value="chennai">Chennai</option>
      </select></td>
   <td>Select List</td>
   <td>4</td>
   <td><input type="button" value="Edit" /><input type="button" value="Delete" /></td>
</tr>

<tr>
   <td>Academic Record</td>
   <td><input type="button" value="Add Table" onclick="addTable.html" /></td>
   <td>Table</td>
   <td>3</td>
   <td><input type="button" value="Edit" /><input type="button" value="Delete" /></td>
</tr>

</table>

<br>

</form>

</body>

</html>

Form2.html

<html>

<head>
<title>Action</title>

<script src="scripts/newQuery.js"></script>

</head>

<body>

<input type="button" value="Add Query" onclick="openPage()" />

&nbsp; &nbsp;

<input type="button" value="Create Metafile" />

</body>

</html>

后来,我使用元素将两个页面添加到"index.html"文件中"frameset",如下所示:

索引.html

<html>

<head>
<title>Main Application case Study</title>
</head>

<frameset rows="75%, *">
   <frame src="Form.html" />
   <frame src="Form2.html" />
</frameset>

</html>

现在,如果我打开"index.html"页面并单击"Add Query"按钮,我会收到一条"prompt"消息,要求我添加我的查询并将其添加到"Form1.html"页面。

我在这里面临的问题是,当我提交要添加到表中的查询时,查询实际上是提交到"Form2.html"页面,因为在"prompt"该页面上编码。但我需要在"Form1.html".

我怎样才能实现它?

4

1 回答 1

0

你让你的生活变得比必要的困难得多。

您想打开一个页面,该页面打开一个执行类似操作的页面

http://www.dzone.com/snippets/add-rows-html-table

function addRow(table,content,morecontent,evenmorecontent) {
     var tabBody=table.getElementsByTagName("TBODY")[0];
     var row=document.createElement("TR");
     var cell1 = document.createElement("TD");
     var cell2 = document.createElement("TD");
     var cell3 = document.createElement("TD");
     var textnode1=document.createTextNode(content);
     var textnode2=document.createTextNode(morecontent);
     var textnode3=document.createTextNode(evenmorecontent);
     cell1.appendChild(textnode1);
     cell2.appendChild(textnode2);
     cell3.appendChild(textnode3);
     row.appendChild(cell1);
     row.appendChild(cell2);
     row.appendChild(cell3);
     tabBody.appendChild(row);
}
var table = opener.opener.document.getElementById("tblQuery");
addRow(table,"cell1 content","cell2 content","cell3 content");
于 2013-01-15T12:38:07.610 回答