Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/418.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何将字段集内容从html传递到html_Javascript_Html_Css - Fatal编程技术网

Javascript 如何将字段集内容从html传递到html

Javascript 如何将字段集内容从html传递到html,javascript,html,css,Javascript,Html,Css,这是我在html1页的代码 <fieldset id="bill1"> <div style="font-size:9px" id="serviced"><b>Service :</b></div> <div style="font-size:9px" id="tratyped"><b>Type of Transport :</b></div>

这是我在html1页的代码

      <fieldset id="bill1">
        <div style="font-size:9px" id="serviced"><b>Service :</b></div>
        <div style="font-size:9px" id="tratyped"><b>Type of Transport :</b></div>
        <div style="font-size:9px" id="custyped"><b>Type of Client</b></div>
        <div style="font-size:9px" id="datepickerd"><b>Date :</b></div>
        <div  style="font-size:9px;display:none" id="timed"><b>Time :</b></div>
        <div  style="font-size:9px" id="departured"><b>Departure Address :</b></div>
        <div style="font-size:9px" id="destinationd"><b>Arrival Address</b></div>
      </fieldset>

服务:
运输类型:
客户类型
日期:
时间:
出发地址:
到达地址
这些div的innerhtml值将在运行时更改

如何在另一个页面html2中发送或查看这些信息

我希望能够从“html1”中提供页面“html2”内的字段集内容,该字段集包含在“php1”页面中(包括“html2”)

请帮我编码,或者只是给你的建议,我会尝试自己编码

谢谢

编辑

Inside fare.html

     <fieldset id="bill2" style="padding-top:0">
        <div style="font-size:9px" id="passengerd"><b>No. of Passengers :</b></div>
        <div style="font-size:9px" id="shairwelld"><b>No. of Chariwells :</b></div>
        <div style="font-size:9px" id="babycd"><b>No. of Baby Chairs :</b></div>
        <div style="font-size:9px" id="companiond"><b>No. of Companions :</b></div>
     </fieldset>

乘客人数:
查利韦尔的数量:
婴儿椅数量:
同伴人数:
在pay.html中

     <fieldset id="bill2">
     </fieldset>

我在head标记中使用jquery代码作为

<script src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    $('#bill2').load('/fare.html #bill2')
})
</script>

$(文档).ready(函数(){
$('#bill2').load('/fare.html#bill2'))
})
上面的代码可以工作

它加载字段集的默认内容。但不加载在运行时生成的值。有办法解决这个问题吗


谢谢

您可以使用javascript生成隐藏表单并提交它。 当您想使用GET时,还可以使用javascript将这些参数添加到当前url并加载此url。

我喜欢您的“请帮助我编写代码,或者给出您的建议,我将尝试自己编写代码。”

你可以用形式来做

创建一个包含一些隐藏文件的表单,在提交该表单时获取
div
的内部html,并使用javascript将其作为隐藏值,然后提交该表单。

您可以使用
.load()
方法:

$(document).ready(function(){
    $('#bill2').load('/html1.html #bill2')
})

其中
#bill2
html2.html
中要从
html1.html
中加载字段集
#bill2
的字段集的id,我尝试了您的代码,但html2页面中的字段集是空的。它没有加载内容。我将以我如何尝试的方式编辑该问题。感谢您的帮助。它仍然不起作用,我也是仔细检查id以确保拼写正确,但字段集没有加载内容。我用我迄今为止尝试过的内容更新了问题。谢谢帮助。这对我很有用。你在fare.html中有什么内容?你在flare的#bill2中有什么内容?在你使用脚本的页面的#bill2中有什么内容?我在使用脚本的方式上有错误吗你有你的HTML文件的文件夹中的jQuery吗?我必须把值从HTML传递到HTML到PHP,因为中间有一个HTML页面,我不能使用GET和POST,请帮我提一下你的建议。我必须把值从HTML传递给HTML,到PHP,因为中间有一个HTML页面,我不能使用。获取并发布请帮助我提出您的建议。