0
我正在使用js和html,所有客户端。我有以下情况...我有一个html表单(在index.html中),它包含一些输入和一个提交按钮。除此之外,表单还包含一个iframe标记,它指向包含其他html表单的另一个页面(other.html)。事情是在这个其他页面称为other.html我有一个文本输入(名称=“信息”)内的表单标签,保存一些信息。javascript和iframe问题
现在我想要做的是提交这个信息的输入值的形式index.html。
例的index.html:
<html>
<body>
<form method="post" action="aphpfile.php">
<input type="text" name="a"/>
<input type="text" name="b"/>
<input type="text" name="c"/>
<iframe id="other1" width="408" height="200" frameborder="0"
scrolling="no" marginheight="0"
marginwidth="0" src="other.html"></iframe>
<input type="submit" value="submit"/>
</form>
</body>
</html>
例other.html:
<html>
<script type="text/javascript">
function setInfo() {
document.getElementById("info").value = "this is the info";
}
</script>
<body>
<form>
<input type="text" id="info" name="info"/>
</form>
<input type="button" onclick="setInfo();" value="setInfo"/>
</body>
</html>
所以从aphpfile.php我想这样做:
$a = $_POST['a'];
$b = $_POST['b'];
$c = $_POST['c'];
$info = $_POST['info'];
echo $a . "," . $b . "," . $c . "," . $info;
感谢您帮帮我。
追加变量作为一个隐藏的输入您要提交表单通过ajax调用。在ajax调用的成功函数上追加变量到你当前的表单。 – 2013-02-25 20:36:02
嗨,谢谢你的回答,你能举个例子吗?我只是在学习js ajax和所有这些东西。谢谢! – Alejandro 2013-02-25 21:00:15
我得到了你所说的,但我不知道如何写这个你正在谈论的ajax代码! thx再次 – Alejandro 2013-02-25 21:01:30