繁体   English   中英

如何将具有表单的html文档引用到另一个html文档以从中创建表?

[英]How to reference an html document with a form to another html document to create a table out of that?

我需要一点帮助。 我被困在使我在第一个html文档中拥有的表单信息显示在第二个html文档中的表上。 现在任何帮助都会真的很好。

我不确定您的问题究竟意味着什么,但是如果您要询问是否在另一个html中包含一个html,请检查此链接: 在另一个html中包含html

编辑:如果您没有使用服务器端编程的选项,则可以使用查询字符串。

在表单中,添加method =“ GET”属性:

<form action="display.html" method="GET">
    <input type="text" name="name" /> 
    <input type="text" name="phone" /> 
    <input type="submit" value="Submit" />
</form>

当他们提交此表单时,会将用户定向到一个地址,该地址包括名称,电话值作为参数。 像: http//www.example.com/display.html?name = XYZ&phone = 98745654

然后,您应该能够使用window.location.search值从JavaScript解析查询字符串(其中将包含参数值):

// from display.html
<p id= 'hi' ></p>

<script>
document.getElementById("hi").innerHTML = window.location.search;
</script>

这应该可以帮助您开始尝试做的事情。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM