简体   繁体   English

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

[英]how to pass fieldset contents from html to html

This is my code in page html1, 这是我在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>

The innerhtml values of those divs will change at runtime. 这些div的innerhtml值将在运行时更改。

How can I send or view these information in another page html2. 如何在另一页html2中发送或查看这些信息。

I want to be able provide the fieldset contents inside the page "html2" from "html1", which is included (include 'html2') into the "php1" page. 我希望能够从“ html1”提供页面“ html2”内的字段集内容,该页面包含(包括“ html2”)到“ php1”页面中。

Please help me with the coding or just give your suggestions, I will try to code it myself. 请帮助我进行编码,或者只是提出您的建议,我会尝试自己编码。

Thanks! 谢谢!

Edit............ 编辑............

Inside fare.html 内部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>

In pay.html 在pay.html中

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

I used the jquery code inside head tag as 我在head标签中使用了jquery代码作为

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

The above code works... 上面的代码有效...

It loads the default content of the fieldset. 它加载字段集的默认内容。 But not loading the values produced during run time. 但是不加载运行时产生的值。 Is there any way to fix this? 有没有什么办法解决这一问题?

Thanks! 谢谢!

You can generate a hidden form with javascript and submit it. 您可以使用javascript生成隐藏表单并提交。 When you want to use GET, you can also add those parameters to the current url with javascript and load this url. 当您要使用GET时,还可以使用javascript将这些参数添加到当前网址中并加载该网址。

I like your "Please help me with the coding or just give your suggestions, I will try to code it myself. 我喜欢您的“请帮助我进行编码,或者只是提出您的建议,我会尝试自己进行编码。

You can do it with form, 你可以用表格来做

Create a form with some hidden fileds, while submitting that form get the div 's inner html and make that as hidden value using javascript and submit that form. 创建一个包含一些隐藏文件的表单,同时提交该表单,获取div的内部html并使用javascript将其设为隐藏值,然后提交该表单。

With jQuery you can use .load() method: 使用jQuery时,您可以使用.load()方法:

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

Where #bill2 is the id of fieldset from html2.html in which you want to load fieldset #bill2 from html1.html 其中#bill2#bill2的ID,您要在其中从html2.html加载#bill2 html1.html #bill2 html1.html

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

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