gpt4 book ai didi

javascript - 如何在javascript中将值从一个页面传递到另一个页面

转载 作者:行者123 更新时间:2023-11-28 08:16:19 24 4
gpt4 key购买 nike

嗨,我有一个用 javascript 创建的表,我需要知道的是如何使用 javascript 通过单击按钮将第 1 行或第 2 行中的值传递到 aspx 页面中:这是我的 JavaScript 代码:

newContent += Hesto.Html.StartTR(item.CommonCable, 'lineInfoRow');
newContent += Hesto.Html.CreateTD('<input type="button" value="Print" id="btnprint" onclick="Redirect()">',null);
newContent += Hesto.Html.CreateTD(item.CommonCable, null, null);
newContent += Hesto.Html.CreateTD(item.Wire, null, null);
newContent += Hesto.Html.CreateTD(item.WireLength * 1000, null, 'centerAlign');
newContent += Hesto.Html.CreateTD(item.TerminalA, null, (sideFlag == 1 ? 'highlightOneSide' : (sideFlag == 3 ? 'highlightTwoSides' : 'highlightNone')));
newContent += Hesto.Html.CreateTD(item.SealA, null, (sideFlag == 1 ? 'highlightOneSide' : (sideFlag == 3 ? 'highlightTwoSides' : 'highlightNone')));
newContent += Hesto.Html.CreateTD(item.TerminalB, null, (sideFlag == 2 ? 'highlightOneSide' : (sideFlag == 3 ? 'highlightTwoSides' : 'highlightNone')));
newContent += Hesto.Html.CreateTD(item.SealB, null, (sideFlag == 2 ? 'highlightOneSide' : (sideFlag == 3 ? 'highlightTwoSides' : 'highlightNone')));
newContent = Hesto.Html.EndTR(newContent);
});

$('#AlternativeReworkCablesList').html(newContent);
}

这是我的重定向页面:

function Redirect() {
window.open ("http://10.19.13.67/ReworkLabels/Default.aspx","my window");
return false;
}

最佳答案

您有几个选择:您可以将数据保存在 cookie 中以便稍后重复使用,您可以将数据作为一系列 GET 变量传递到下一页,或者您可以加载使用 AJAX 访问下一页,以便您的变量保持可用。

由于您使用的是 ASP,因此您可以执行以下操作:

function Redirect() {
window.open ("http://10.19.13.67/ReworkLabels/Default.aspx?myVariable=" + myVariable,"my window");
return false;
}

关于javascript - 如何在javascript中将值从一个页面传递到另一个页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23561454/

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