gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 13:39:46 25 4
gpt4 key购买 nike

这是我在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”内的字段集内容,该页面包含(包括“html2”)到“php1”页面中。

请帮助我编码或给出您的建议,我会尝试自己编码。

谢谢!

编辑......................

内部 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>

上面的代码有效...

它加载字段集的默认内容。但不加载运行时产生的值。有什么办法可以解决这个问题吗?

谢谢!

最佳答案

jQuery你可以使用 .load() 方法:

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

其中 #bill2html2.html 中的字段集的 ID,您要在其中加载 html1 中的字段集 #bill2 .html

关于javascript - 如何将字段集内容从html传递到html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12563098/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com