Javascript 如何在html中的多个文本框中将多个文本框值从一个网页传输到另一个网页
我想将输入值从这些文本框传输到html格式的另一个网页文本框 有两个文件 这是第一个网页 javscript代码 函数将文件传输到另一个网页Javascript 如何在html中的多个文本框中将多个文本框值从一个网页传输到另一个网页,javascript,html,css,Javascript,Html,Css,我想将输入值从这些文本框传输到html格式的另一个网页文本框 有两个文件 这是第一个网页 javscript代码 函数将文件传输到另一个网页 function transferdata() { var inputTest = document.getElementById('FROM').value; var inputTest1 = document.getElementById('TO').value; var
function transferdata() {
var inputTest = document.getElementById('FROM').value;
var inputTest1 = document.getElementById('TO').value;
var inputTest2 = document.getElementById('jdate').value;
if (inputTest=="") {
window.open('report_pengambilan_singgle.html','','height=650,width=1200');
}
else {
window.open('trial25.html?name=' + inputTest,'','height=650,width=1200');
}
}
html code
this is the body of the code
<form >
<label ><H2>SOURCE</h2></label><br>
<input type="text" id="FROM" name="FROM" ><BR>
<label ><H2>DESTINATION</H2></label><BR>
<input type="text" id="TO" name="TO" ><BR>
<h2> Date of Journey<input type = "date" name = "jdate" id = "jdate"></h2>
<br>
</form>
second file this the another file which will recive the data
javscript code
// Recive data from destination.html
window.onload = function () {
var url = document.location.href,
params = url.split('?')[1].split('&'),
data = {}, tmp;
for (var i = 0, l = params.length; i < l; i++) {
tmp = params[i].split('=');
data[tmp[0]] = tmp[1];
}
document.getElementById("source1").value = data.name;
document.getElementById("date").value = data.name;
document.getElementById("dest").value = data.name;
}
html code
this is the body of the another web page code
<form>
<h3> Source <input type = "text" name = "source1" id = "source1" /> </h3>
<h3> Destination <input type = "text" name = "dest" id = "dest" /> </h3>
<h3> Booking Date <input type = "date" name = "date1" id = "date1" /> </h3>
</form>
函数transferdata(){
var inputTest=document.getElementById('FROM')。值;
var inputTest1=document.getElementById('TO')。值;
var inputtes2=document.getElementById('jdate')。值;
如果(输入测试==“”){
window.open('report_pengambilan_singgle.html','','height=650,width=1200');
}
否则{
open('trial25.html?name='+inputTest','height=650,width=1200');
}
}
html代码
这是代码的主体
来源
目的地
旅行日期
第二个文件这是另一个将接收数据的文件
javscript代码
//从destination.html接收数据
window.onload=函数(){
var url=document.location.href,
params=url.split('?')[1]。split('&'),
数据={},tmp;
对于(变量i=0,l=params.length;i
这是我希望从第一个网页输入字段接收数据的输入字段