如何在javascript中将值从一个页面传递到另一个页面 [英] how to pass values from one page to another page in javascript
本文介绍了如何在javascript中将值从一个页面传递到另一个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好我有一个用javascript创建的表,我需要知道的是如何使用javascript点击按钮将第1行或第2行中的值传递到aspx页面:
这里是我的javascript代码:
Hi I have a table that was created in javascript, what I need to know is how to pass the values in row 1 or 2 into a aspx page using javascript with the click of a button: here is my javascript code:
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;
}
推荐答案
发送大量数据你可以试试这个:
To send big amount of data you can try this:
- 使用方法post和action等于你要重定向的url创建表单(表单可以隐藏 - 它是没问题)
- 创建
textarea
/text
字段(不是必需的)in此表单 - 将您的数据放入此textarea
- 通过JS提交表单
- 在新页面上接收数据
- Create form with method post and action equal to url you want to redirect to (form can be hidden — it is not problem)
- Create
textarea
/text
field (not neccessary) in this form - Put your data in this textarea
- Submit form via JS
- Receive data on new page
注意,javascript将以此形式转义数据。要使用它,请使用 unescape()
功能。
Note, that javascript will escape data in this form. To unescape it use unescape()
function.
这篇关于如何在javascript中将值从一个页面传递到另一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文