1. Usually we use url value transfer to transfer some data with a small amount of data, such as some parameters, etc., and use session to transfer some global session-level variables. But if you want to transfer some more complex data between forms, the session life cycle is too long and may not be appropriate. When using URL to transfer values, encoding errors may occur in Chinese characters, and the maximum amount of data that can be transferred is relatively limited.
2. We can use the dialogArguments attribute of the modal dialog box to achieve cross-page data transfer.
The dialogArguments property of the modal dialog box can be obtained in the following way:
var Variables = window.dialogArguments
Use this property to obtain the incoming parameters of the modal dialog box, which can be String, numeric, object, or array value that specifies arguments. Especially object or array parameters are very useful for passing data between pages. An example is as follows:
Incoming page:
<HTML>
<HEAD>
<SCRIPT>
function AddNew(meetingID) {
var obj=new Object();
obj.name="qiubinchao";
obj.tel="12345678"; var strUrl="../MeetingManage/NewMeeting.aspx?id="+meetingID; window.showModalDialog(strUrl,obj,"dialogHeight:700px;dialogWidth=900px;dialogTop=10px;dialogLeft: 50px;"); window.location="../MeetingManage/MeetingPublishedList.aspx"; }
</SCRIPT>
</HEAD>
<BODY>
<BUTTON onclick="AddNew();" >Launch The Window</BUTTON>
</BODY>
</HTML>
Receive page:
<HTML>
<HEAD>
<SCRIPT>
var oMyObject = window.dialogArguments;
var name= oMyObject.name;
var tel= oMyObject.tel;
</SCRIPT>
<title>Untitled</title>
</head>
<BODY STYLE="font-family: arial; font-size: 14pt; color: Snow;
background-color: RosyBrown;">
Name:
<SPAN STYLE="color:00ff7f">
<SCRIPT>
document.write(name);
</SCRIPT>
</SPAN>
<BR>
Tel:
<SPAN STYLE="color:00ff7f">
<SCRIPT>
document.write(tel);
</SCRIPT>
</SPAN>
</BODY>
</HTML>